Merge pull request #13 from ptitSeb/master

Fixes some Memory Corruptions, in 64bits and/or using Portable C
This commit is contained in:
Ryan C. Gordon 2016-04-07 12:04:08 -04:00
commit 749dc05fed
6 changed files with 34 additions and 20 deletions

View File

@ -59,7 +59,7 @@ BOOL PeekMessage(MSG *msg, void *hwnd, UINT wMsgFilterMin,
break; break;
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
if (sdlevent.button.button == 2) // right button... if (sdlevent.button.button == SDL_BUTTON_RIGHT) // right button...
{ {
msg->message = WM_RBUTTONDOWN; msg->message = WM_RBUTTONDOWN;
} // if } // if
@ -78,7 +78,7 @@ BOOL PeekMessage(MSG *msg, void *hwnd, UINT wMsgFilterMin,
break; break;
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
if (sdlevent.button.button == 2) // right button... if (sdlevent.button.button == SDL_BUTTON_RIGHT) // right button...
{ {
msg->message = WM_RBUTTONUP; msg->message = WM_RBUTTONUP;
} // if } // if

View File

@ -328,13 +328,13 @@ static void sdl_event_handler(const SDL_Event *event)
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
switch (event->button.button) switch (event->button.button)
{ {
case 1: case SDL_BUTTON_LEFT:
_abKeysPressed[KID_MOUSE1] = TRUE; _abKeysPressed[KID_MOUSE1] = TRUE;
break; break;
case 2: case SDL_BUTTON_RIGHT:
_abKeysPressed[KID_MOUSE2] = TRUE; _abKeysPressed[KID_MOUSE2] = TRUE;
break; break;
case 3: case SDL_BUTTON_MIDDLE:
_abKeysPressed[KID_MOUSE3] = TRUE; _abKeysPressed[KID_MOUSE3] = TRUE;
break; break;
@ -351,13 +351,13 @@ static void sdl_event_handler(const SDL_Event *event)
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
switch (event->button.button) switch (event->button.button)
{ {
case 1: case SDL_BUTTON_LEFT:
_abKeysPressed[KID_MOUSE1] = FALSE; _abKeysPressed[KID_MOUSE1] = FALSE;
break; break;
case 2: case SDL_BUTTON_RIGHT:
_abKeysPressed[KID_MOUSE2] = FALSE; _abKeysPressed[KID_MOUSE2] = FALSE;
break; break;
case 3: case SDL_BUTTON_MIDDLE:
_abKeysPressed[KID_MOUSE3] = FALSE; _abKeysPressed[KID_MOUSE3] = FALSE;
break; break;

View File

@ -221,8 +221,8 @@ typedef unsigned int UINT;
typedef char CHAR; typedef char CHAR;
typedef UBYTE BYTE; typedef UBYTE BYTE;
typedef unsigned short WORD; typedef unsigned short WORD;
typedef unsigned long int DWORD; typedef unsigned int DWORD;
typedef signed long int LONG; typedef signed int LONG;
typedef void *LPVOID; typedef void *LPVOID;
typedef char *LPSTR; typedef char *LPSTR;
typedef signed long int WPARAM; typedef signed long int WPARAM;

View File

@ -1998,7 +1998,7 @@ __forceinline void CLayerMixer::FillShadowLayer( COLOR col)
{ {
#if (defined USE_PORTABLE_C) #if (defined USE_PORTABLE_C)
DWORD* dst = (DWORD*)lm_pulShadowMap; DWORD* dst = (DWORD*)lm_pulShadowMap;
int n = lm_pixCanvasSizeV*lm_pixCanvasSizeV; int n = lm_pixCanvasSizeU*lm_pixCanvasSizeV;
DWORD color = __builtin_bswap32(col); DWORD color = __builtin_bswap32(col);
while(n--) {*(dst++)=color;} while(n--) {*(dst++)=color;}
#elif (defined __MSVC_INLINE__) #elif (defined __MSVC_INLINE__)

14
Sources/EntitiesMP/Devil.es Normal file → Executable file
View File

@ -1568,7 +1568,7 @@ procedures:
} }
InflictHoofDamage( DEVIL_HIT_HOOF_OFFSET); InflictHoofDamage( DEVIL_HIT_HOOF_OFFSET);
autowait(GetModelObject()->GetAnimLength(DEVIL_ANIM_ATTACKCLOSE-1.4f)-_pTimer->TickQuantum); autowait(GetModelObject()->GetAnimLength(DEVIL_ANIM_ATTACKCLOSE)-1.4f-_pTimer->TickQuantum); // misplaced ) here ???
return EReturn(); return EReturn();
}; };
@ -1599,7 +1599,7 @@ procedures:
case DAP_PLAYER_HUNT: case DAP_PLAYER_HUNT:
if( _pTimer->CurrentTick()-m_tmLastAngry > 10.0f) if( _pTimer->CurrentTick()-m_tmLastAngry > 10.0f)
{ {
m_fAttackFireTime = 7.5+FRnd()*5; m_fAttackFireTime = 7.5f+FRnd()*5.0f;
m_tmLastAngry = _pTimer->CurrentTick(); m_tmLastAngry = _pTimer->CurrentTick();
SelectRandomAnger(); SelectRandomAnger();
jump Angry(); jump Angry();
@ -1715,7 +1715,7 @@ procedures:
FLOAT3D vShooting = GetPlacement().pl_PositionVector; FLOAT3D vShooting = GetPlacement().pl_PositionVector;
FLOAT3D vTarget = m_penEnemy->GetPlacement().pl_PositionVector; FLOAT3D vTarget = m_penEnemy->GetPlacement().pl_PositionVector;
FLOAT fDistanceFactor = 1.0f-ClampUp( (vShooting-vTarget).Length()/250.0f, 1.0f); FLOAT fDistanceFactor = 1.0f-ClampUp( (vShooting-vTarget).Length()/250.0f, 1.0f);
fWantedPitch = 20-fDistanceFactor*50.0f; fWantedPitch = 20.0f-fDistanceFactor*50.0f;
} }
CAttachmentModelObject &amo = *GetModelObject()->GetAttachmentModel(m_iAttID); CAttachmentModelObject &amo = *GetModelObject()->GetAttachmentModel(m_iAttID);
@ -2028,7 +2028,7 @@ procedures:
autowait( m_tmLastPause); autowait( m_tmLastPause);
// fire one guided projectile // fire one guided projectile
ShootProjectile(PRT_DEVIL_GUIDED_PROJECTILE, MAGIC_PROJECTILE_EXIT, ShootProjectile(PRT_DEVIL_GUIDED_PROJECTILE, MAGIC_PROJECTILE_EXIT,
ANGLE3D( AngleDeg(10.0f*Cos(m_iFiredProjectiles*360.0/6.0f)), -AngleDeg(20.0f*Sin(m_iFiredProjectiles*180.0/6.0f)), 0)); ANGLE3D( AngleDeg(10.0f*Cos(m_iFiredProjectiles*360.0f/6.0f)), -AngleDeg(20.0f*Sin(m_iFiredProjectiles*180.0f/6.0f)), 0));
PlayWeaponSound( SOUND_ATTACK_BREATH_FIRE); PlayWeaponSound( SOUND_ATTACK_BREATH_FIRE);
autowait(0.8f-m_tmLastPause); autowait(0.8f-m_tmLastPause);
@ -2244,9 +2244,9 @@ procedures:
SetHealth(5000); SetHealth(5000);
} }
m_fMaxHealth = BOSS_HEALTH; m_fMaxHealth = BOSS_HEALTH;
m_fBlowUpAmount = 1e6; m_fBlowUpAmount = 1e6f;
m_fBodyParts = 6; m_fBodyParts = 6.0f;
m_fDamageWounded = 1e9; m_fDamageWounded = 1e9f;
en_fDensity = 2500.0f; en_fDensity = 2500.0f;
m_bHasUpperWeapons = FALSE; m_bHasUpperWeapons = FALSE;
m_bRenderElectricity = FALSE; m_bRenderElectricity = FALSE;

View File

@ -123,6 +123,20 @@ CTextureObject *_ptoLogoCT = NULL;
CTextureObject *_ptoLogoODI = NULL; CTextureObject *_ptoLogoODI = NULL;
CTextureObject *_ptoLogoEAX = NULL; CTextureObject *_ptoLogoEAX = NULL;
#if 0 // First Encounter (not working for now)
CTString sam_strVersion = "1.10";
CTString sam_strModName = TRANS("- O P E N S O U R C E -");
#if _SE_DEMO
CTString sam_strFirstLevel = "Levels\\KarnakDemo.wld";
#else
CTString sam_strFirstLevel = "Levels\\01_Hatshepsut.wld";
#endif
CTString sam_strIntroLevel = "Levels\\Intro.wld";
CTString sam_strGameName = "serioussamfe";
CTString sam_strTechTestLevel = "Levels\\TechTest.wld";
CTString sam_strTrainingLevel = "Levels\\KarnakDemo.wld";
#else // Second Encounter
CTString sam_strVersion = "1.10"; CTString sam_strVersion = "1.10";
CTString sam_strModName = TRANS("- O P E N S O U R C E -"); CTString sam_strModName = TRANS("- O P E N S O U R C E -");
@ -130,12 +144,12 @@ CTString sam_strFirstLevel = "Levels\\LevelsMP\\1_0_InTheLastEpisode.wld";
CTString sam_strIntroLevel = "Levels\\LevelsMP\\Intro.wld"; CTString sam_strIntroLevel = "Levels\\LevelsMP\\Intro.wld";
CTString sam_strGameName = "serioussamse"; CTString sam_strGameName = "serioussamse";
CTString sam_strTechTestLevel = "Levels\\LevelsMP\\TechTest.wld"; CTString sam_strTechTestLevel = "Levels\\LevelsMP\\Technology\\TechTest.wld";
CTString sam_strTrainingLevel = "Levels\\KarnakDemo.wld"; CTString sam_strTrainingLevel = "Levels\\KarnakDemo.wld";
#endif
ENGINE_API extern INDEX snd_iFormat; ENGINE_API extern INDEX snd_iFormat;
// main window canvas // main window canvas
CDrawPort *pdp; CDrawPort *pdp;
CDrawPort *pdpNormal; CDrawPort *pdpNormal;