few more smaller code cleanups
This commit is contained in:
1 parent
4e606fc7de
commit
2eb175c356
7 files changed
+29
-27
No files matched your search
@@ -555,7 +555,8 @@ static void HWR_FreePatchCache(boolean freeall)
|
||||
callback = FreeColormapsCallback;
|
||||
|
||||
//Z_IterateTags(PU_PATCH, PU_PATCH_ROTATED, callback);
|
||||
Z_IterateTags(PU_PATCH, PU_PATCH, callback);
|
||||
//Z_IterateTags(PU_PATCH, PU_PATCH_LOWPRIORITY, callback); // we dont really need to free low priority patches here as P_FreeLevelState takes care of them
|
||||
Z_IterateTag(PU_PATCH, callback);
|
||||
Z_IterateTags(PU_SPRITE, PU_HUDGFX, callback);
|
||||
}
|
||||
|
||||
|
||||
+7
-8
@@ -579,8 +579,8 @@ FUNCINLINE static ATTRINLINE int call_mobj_type_hooks(Hook_State *hook, mobjtype
|
||||
static UINT8 seen = 0; // so we dont have to check all this shit constantly
|
||||
int numCalls = call_mapped(hook, &mobjHookIds[mobj_type][hook->hook_type]);
|
||||
|
||||
if (!seen && numCalls > 0 && mobj_type == MT_NULL && (
|
||||
hook->hook_type == MOBJ_HOOK(MobjThinker )
|
||||
if (!seen && numCalls > 0 && mobj_type == MT_NULL &&
|
||||
( hook->hook_type == MOBJ_HOOK(MobjThinker )
|
||||
|| hook->hook_type == MOBJ_HOOK(MobjCollide )
|
||||
|| hook->hook_type == MOBJ_HOOK(MobjMoveCollide)
|
||||
|| hook->hook_type == MOBJ_HOOK(MobjFuse )
|
||||
@@ -588,6 +588,7 @@ FUNCINLINE static ATTRINLINE int call_mobj_type_hooks(Hook_State *hook, mobjtype
|
||||
))
|
||||
{
|
||||
seen = 1;
|
||||
|
||||
CONS_Alert(
|
||||
CONS_WARNING, "%s\n", va(
|
||||
"%s hooks not attached to a specific mobj type may cause performance issues!",
|
||||
@@ -609,12 +610,10 @@ FUNCINLINE static ATTRINLINE int call_mobj_type_hooks(Hook_State *hook, mobjtype
|
||||
return numCalls;
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCINLINE static ATTRINLINE int call_mobj_type_hooks(Hook_State *hook, mobjtype_t mobj_type)
|
||||
/*FUNCINLINE static ATTRINLINE int call_mobj_type_hooks(Hook_State *hook, mobjtype_t mobj_type)
|
||||
{
|
||||
return call_mapped(hook, &mobjHookIds[mobj_type][hook->hook_type]);
|
||||
}
|
||||
*/
|
||||
}*/
|
||||
|
||||
static int call_hooks
|
||||
(
|
||||
@@ -899,7 +898,7 @@ int LUA_HookShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT3
|
||||
int LUA_HookMobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage)
|
||||
{
|
||||
return damage_hook(target, inflictor, source, damage,
|
||||
MOBJ_HOOK(MobjDamage), res_true);
|
||||
MOBJ_HOOK(MobjDamage), res_true);
|
||||
}
|
||||
|
||||
int LUA_HookMobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
@@ -988,7 +987,7 @@ void LUA_HookLinedefExecute(line_t *line, mobj_t *mo, sector_t *sector)
|
||||
{
|
||||
Hook_State hook = {};
|
||||
if (prepare_string_hook
|
||||
(&hook, 0, STRING_HOOK(LinedefExecute), line->text))
|
||||
(&hook, 0, STRING_HOOK(LinedefExecute), line->text))
|
||||
{
|
||||
LUA_PushUserdata(gL, line, META_LINE);
|
||||
LUA_PushUserdata(gL, mo, META_MOBJ);
|
||||
|
||||
@@ -591,6 +591,7 @@ void LUA_InvalidateLevel(void)
|
||||
|
||||
for (i = 0; i < numsubsectors; i++)
|
||||
LUA_InvalidateUserdata(&subsectors[i]);
|
||||
|
||||
for (i = 0; i < numsectors; i++)
|
||||
{
|
||||
LUA_InvalidateUserdata(§ors[i]);
|
||||
@@ -611,6 +612,7 @@ void LUA_InvalidateLevel(void)
|
||||
|
||||
for (i = 0; i < numsides; i++)
|
||||
LUA_InvalidateUserdata(&sides[i]);
|
||||
|
||||
for (i = 0; i < numvertexes; i++)
|
||||
LUA_InvalidateUserdata(&vertexes[i]);
|
||||
|
||||
|
||||
+3
-3
@@ -245,12 +245,12 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
||||
|
||||
static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
|
||||
{
|
||||
player_t *p = object->player; // will be NULL if not a player
|
||||
player_t *player = object->player; // will be NULL if not a player
|
||||
fixed_t zdist; // distance between bottoms
|
||||
fixed_t speed = spring->info->mass; // conveniently, both fans and gas jets use this for the vertical thrust
|
||||
SINT8 flipval = P_MobjFlip(spring); // virtually everything here centers around the thruster's gravity, not the object's!
|
||||
|
||||
if (p && object->state == &states[object->info->painstate]) // can't use fans and gas jets when player is in pain!
|
||||
if (player && object->state == &states[object->info->painstate]) // can't use fans and gas jets when player is in pain!
|
||||
return;
|
||||
|
||||
// is object's top below thruster's position? if not, calculate distance between their bottoms
|
||||
@@ -276,7 +276,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
|
||||
break;
|
||||
if (flipval*object->momz >= FixedMul(speed, spring->scale)) // if object's already moving faster than your best, don't bother
|
||||
break;
|
||||
if (p && (p->climbing || p->pflags & PF_GLIDING)) // doesn't affect Knux when he's using his abilities!
|
||||
if (player && (player->climbing || player->pflags & PF_GLIDING)) // doesn't affect Knux when he's using his abilities!
|
||||
break;
|
||||
|
||||
object->momz += flipval*FixedMul(speed/4, spring->scale);
|
||||
|
||||
+4
-4
@@ -2161,7 +2161,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
newname[1] = 'C';
|
||||
newname[2] = 'R';
|
||||
|
||||
scrnum = sides[line->sidenum[0]].textureoffset>>FRACBITS;
|
||||
scrnum = sides[line->sidenum[0]].textureoffset >> FRACBITS;
|
||||
if (scrnum < 0 || scrnum > 999)
|
||||
{
|
||||
scrnum = 0;
|
||||
@@ -2169,9 +2169,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
}
|
||||
else
|
||||
{
|
||||
newname[5] = (char)('0' + (char)((scrnum/100)));
|
||||
newname[6] = (char)('0' + (char)((scrnum%100)/10));
|
||||
newname[7] = (char)('0' + (char)(scrnum%10));
|
||||
newname[5] = (char)('0' + (char)((scrnum / 100)));
|
||||
newname[6] = (char)('0' + (char)((scrnum % 100) / 10));
|
||||
newname[7] = (char)('0' + (char)(scrnum % 10));
|
||||
}
|
||||
newname[8] = '\0';
|
||||
|
||||
|
||||
+9
-9
@@ -433,7 +433,7 @@ static boolean S_CheckSameSoundLimit(sfxenum_t sfx_id)
|
||||
return true;
|
||||
|
||||
for (cnum = 0; cnum < numofchannels; cnum++)
|
||||
if ((size_t)(channels[cnum].sfxinfo - S_sfx) == (size_t)sfx_id)
|
||||
if (channels[cnum].sfxinfo == &S_sfx[sfx_id])
|
||||
scount++;
|
||||
|
||||
//CONS_Printf("same sound count: %d for sfx: %d\n", scount, sfx_id);
|
||||
@@ -864,18 +864,18 @@ void S_SetSfxVolume(INT32 volume)
|
||||
if (volume < 0 || volume > 31)
|
||||
CONS_Alert(CONS_WARNING, "sfxvolume should be between 0-31\n");
|
||||
|
||||
CV_SetValue(&cv_soundvolume, volume&0x1F);
|
||||
CV_SetValue(&cv_soundvolume, volume & 0x1F);
|
||||
actualsfxvolume = cv_soundvolume.value; // check for change of var
|
||||
|
||||
// now hardware volume
|
||||
I_SetSfxVolume(volume&0x1F);
|
||||
I_SetSfxVolume(volume & 0x1F);
|
||||
}
|
||||
|
||||
void S_ClearSfx(void)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 1; i < NUMSFX; i++)
|
||||
I_FreeSfx(S_sfx + i);
|
||||
I_FreeSfx(&S_sfx[i]);
|
||||
}
|
||||
|
||||
static void S_StopChannel(INT32 cnum)
|
||||
@@ -1067,12 +1067,12 @@ INT32 S_OriginPlaying(void *origin)
|
||||
|
||||
// Searches through the channels and checks if a given id
|
||||
// is playing anywhere.
|
||||
INT32 S_IdPlaying(sfxenum_t id)
|
||||
INT32 S_IdPlaying(sfxenum_t sfx_id)
|
||||
{
|
||||
INT32 cnum;
|
||||
|
||||
for (cnum = 0; cnum < numofchannels; cnum++)
|
||||
if ((size_t)(channels[cnum].sfxinfo - S_sfx) == (size_t)id)
|
||||
if (channels[cnum].sfxinfo == &S_sfx[sfx_id])
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
@@ -1080,7 +1080,7 @@ INT32 S_IdPlaying(sfxenum_t id)
|
||||
|
||||
// Searches through the channels and checks for
|
||||
// origin x playing sound id y.
|
||||
INT32 S_SoundPlaying(void *origin, sfxenum_t id)
|
||||
INT32 S_SoundPlaying(void *origin, sfxenum_t sfx_id)
|
||||
{
|
||||
INT32 cnum;
|
||||
|
||||
@@ -1089,8 +1089,8 @@ INT32 S_SoundPlaying(void *origin, sfxenum_t id)
|
||||
|
||||
for (cnum = 0; cnum < numofchannels; cnum++)
|
||||
{
|
||||
if (channels[cnum].origin == origin
|
||||
&& (size_t)(channels[cnum].sfxinfo - S_sfx) == (size_t)id)
|
||||
if (channels[cnum].origin == origin &&
|
||||
channels[cnum].sfxinfo == &S_sfx[sfx_id])
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -286,8 +286,8 @@ void S_SetSfxVolume(INT32 volume);
|
||||
void S_SetMusicVolume(INT32 volume);
|
||||
|
||||
INT32 S_OriginPlaying(void *origin);
|
||||
INT32 S_IdPlaying(sfxenum_t id);
|
||||
INT32 S_SoundPlaying(void *origin, sfxenum_t id);
|
||||
INT32 S_IdPlaying(sfxenum_t sfx_id);
|
||||
INT32 S_SoundPlaying(void *origin, sfxenum_t sfx_id);
|
||||
|
||||
void S_StartSoundName(void *mo, const char *soundname);
|
||||
|
||||
|
||||
Reference in new issue
Block a user