mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
- added assignment to an unused scratch variable to the InitActor*Noise functions.
They are used a state identifiers but identical content-wise so MSVC's linker would merge them all together into one if some code wasn't added to make them different. A global check for the scratch variable was added in a harmless place to ensure that whole program optimization algorithms won't optimize it out anyway after discovering that the variable is never used.
This commit is contained in:
parent
c34d9da783
commit
a594ba32d4
2 changed files with 21 additions and 7 deletions
|
@ -876,10 +876,17 @@ DoActorDecide(short SpriteNum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Important note: The functions below are being checked for as state identifiers.
|
||||
// But they are all identical content wise which makes MSVC merge them together into one.
|
||||
// Assigning 'sw_snd_scratch' different values makes them different so that merging does not occur.
|
||||
int sw_snd_scratch = 0;
|
||||
|
||||
|
||||
int
|
||||
InitActorAlertNoise(short SpriteNum)
|
||||
{
|
||||
USERp u = User[SpriteNum];
|
||||
sw_snd_scratch = 1;
|
||||
// MONO_PRINT(strcpy(ds,"Init Actor Threat Noise"));
|
||||
|
||||
// make some sort of noise here
|
||||
|
@ -895,6 +902,7 @@ int
|
|||
InitActorAmbientNoise(short SpriteNum)
|
||||
{
|
||||
USERp u = User[SpriteNum];
|
||||
sw_snd_scratch = 2;
|
||||
|
||||
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
|
||||
|
||||
|
@ -910,6 +918,7 @@ int
|
|||
InitActorAttackNoise(short SpriteNum)
|
||||
{
|
||||
USERp u = User[SpriteNum];
|
||||
sw_snd_scratch = 3;
|
||||
|
||||
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
|
||||
|
||||
|
@ -925,6 +934,7 @@ int
|
|||
InitActorPainNoise(short SpriteNum)
|
||||
{
|
||||
USERp u = User[SpriteNum];
|
||||
sw_snd_scratch = 4;
|
||||
|
||||
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
|
||||
|
||||
|
@ -940,6 +950,7 @@ int
|
|||
InitActorDieNoise(short SpriteNum)
|
||||
{
|
||||
USERp u = User[SpriteNum];
|
||||
sw_snd_scratch = 5;
|
||||
|
||||
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
|
||||
|
||||
|
@ -955,7 +966,7 @@ int
|
|||
InitActorExtra1Noise(short SpriteNum)
|
||||
{
|
||||
USERp u = User[SpriteNum];
|
||||
|
||||
sw_snd_scratch = 6;
|
||||
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
|
||||
|
||||
// make some sort of noise here
|
||||
|
@ -970,7 +981,7 @@ int
|
|||
InitActorExtra2Noise(short SpriteNum)
|
||||
{
|
||||
USERp u = User[SpriteNum];
|
||||
|
||||
sw_snd_scratch = 7;
|
||||
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
|
||||
|
||||
// make some sort of noise here
|
||||
|
@ -985,7 +996,7 @@ int
|
|||
InitActorExtra3Noise(short SpriteNum)
|
||||
{
|
||||
USERp u = User[SpriteNum];
|
||||
|
||||
sw_snd_scratch = 8;
|
||||
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
|
||||
|
||||
// make some sort of noise here
|
||||
|
@ -1000,7 +1011,7 @@ int
|
|||
InitActorExtra4Noise(short SpriteNum)
|
||||
{
|
||||
USERp u = User[SpriteNum];
|
||||
|
||||
sw_snd_scratch = 9;
|
||||
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
|
||||
|
||||
// make some sort of noise here
|
||||
|
@ -1015,7 +1026,7 @@ int
|
|||
InitActorExtra5Noise(short SpriteNum)
|
||||
{
|
||||
USERp u = User[SpriteNum];
|
||||
|
||||
sw_snd_scratch = 10;
|
||||
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
|
||||
|
||||
// make some sort of noise here
|
||||
|
@ -1030,7 +1041,7 @@ int
|
|||
InitActorExtra6Noise(short SpriteNum)
|
||||
{
|
||||
USERp u = User[SpriteNum];
|
||||
|
||||
sw_snd_scratch = 11;
|
||||
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
|
||||
|
||||
// make some sort of noise here
|
||||
|
|
|
@ -113,6 +113,8 @@ SWBOOL MNU_StartNetGame(void);
|
|||
|
||||
extern SWBOOL MultiPlayQuitFlag;
|
||||
|
||||
extern int sw_snd_scratch;
|
||||
|
||||
|
||||
#if DEBUG
|
||||
#define BETA 0
|
||||
|
@ -2772,7 +2774,8 @@ int32_t GameInterface::app_main()
|
|||
else
|
||||
buildputs("SHADOW WARRIOR(tm) Version 1.2\n");
|
||||
|
||||
buildputs("Copyright (c) 1997 3D Realms Entertainment\n");
|
||||
if (sw_snd_scratch == 0) // This is always 0 at this point - this check is only here to prevent whole program optimization from eliminating the variable.
|
||||
buildputs("Copyright (c) 1997 3D Realms Entertainment\n");
|
||||
|
||||
UserMapName[0] = '\0';
|
||||
|
||||
|
|
Loading…
Reference in a new issue