diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index c4cd7d383..423a75b32 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -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); } diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 82c1a00d6..d8778263c 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -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); diff --git a/src/lua_script.c b/src/lua_script.c index 0943eef68..14cdee2d7 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -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]); diff --git a/src/p_map.c b/src/p_map.c index 753d576b6..9c974ce44 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -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); diff --git a/src/p_spec.c b/src/p_spec.c index 560ac0b2a..fd69275a0 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -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'; diff --git a/src/s_sound.c b/src/s_sound.c index d7f4a2853..278c87853 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -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; } diff --git a/src/s_sound.h b/src/s_sound.h index 077fd325e..5d9d9949f 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -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);