diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index b8b1605b0..14dd77e42 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -73,13 +73,13 @@ void SerializeActorGlobals(FSerializer& arc) { fire.Clear(); if (!res) return; - auto length = arc.ArraySize() / 2; + int length = arc.ArraySize() / 2; int key; FireProj value; for (int i = 0; i < length; i++) { - Serialize(arc, nullptr, key, nullptr); + arc(nullptr, key); Serialize(arc, nullptr, value, nullptr); fire.Insert(key, value); } @@ -144,10 +144,9 @@ bool floorspace_d(int sectnum) // //--------------------------------------------------------------------------- -void check_fta_sounds_d(int i) +void check_fta_sounds_d(DDukeActor* actor) { - auto spri = &sprite[i]; - if (spri->extra > 0) switch (spri->picnum) + if (actor->s.extra > 0) switch (actor->s.picnum) { case LIZTROOPONTOILET: case LIZTROOPJUSTSIT: @@ -156,56 +155,56 @@ void check_fta_sounds_d(int i) case LIZTROOPDUCKING: case LIZTROOPRUNNING: case LIZTROOP: - S_PlayActorSound(PRED_RECOG, i); + S_PlayActorSound(PRED_RECOG, actor); break; case LIZMAN: case LIZMANSPITTING: case LIZMANFEEDING: case LIZMANJUMP: - S_PlayActorSound(CAPT_RECOG, i); + S_PlayActorSound(CAPT_RECOG, actor); break; case PIGCOP: case PIGCOPDIVE: - S_PlayActorSound(PIG_RECOG, i); + S_PlayActorSound(PIG_RECOG, actor); break; case RECON: - S_PlayActorSound(RECO_RECOG, i); + S_PlayActorSound(RECO_RECOG, actor); break; case DRONE: - S_PlayActorSound(DRON_RECOG, i); + S_PlayActorSound(DRON_RECOG, actor); break; case COMMANDER: case COMMANDERSTAYPUT: - S_PlayActorSound(COMM_RECOG, i); + S_PlayActorSound(COMM_RECOG, actor); break; case ORGANTIC: - S_PlayActorSound(TURR_RECOG, i); + S_PlayActorSound(TURR_RECOG, actor); break; case OCTABRAIN: case OCTABRAINSTAYPUT: - S_PlayActorSound(OCTA_RECOG, i); + S_PlayActorSound(OCTA_RECOG, actor); break; case BOSS1: S_PlaySound(BOS1_RECOG); break; case BOSS2: - if (spri->pal == 1) + if (actor->s.pal == 1) S_PlaySound(BOS2_RECOG); else S_PlaySound(WHIPYOURASS); break; case BOSS3: - if (spri->pal == 1) + if (actor->s.pal == 1) S_PlaySound(BOS3_RECOG); else S_PlaySound(RIPHEADNECK); break; case BOSS4: case BOSS4STAYPUT: - if (spri->pal == 1) + if (actor->s.pal == 1) S_PlaySound(BOS4_RECOG); S_PlaySound(BOSS4_FIRSTSEE); break; case GREENSLIME: - S_PlayActorSound(SLIM_RECOG, i); + S_PlayActorSound(SLIM_RECOG, actor); break; } } @@ -781,7 +780,7 @@ void movefta_d(void) default: ht->timetosleep = 0; - fi.check_fta_sounds(i); + check_fta_sounds_d(&hittype[i]); changespritestat(i, STAT_ACTOR); break; } diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 6f02d0554..89d8eb888 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -92,18 +92,18 @@ bool floorspace_r(int sectnum) // //--------------------------------------------------------------------------- -void check_fta_sounds_r(int i) +void check_fta_sounds_r(DDukeActor* actor) { - if (sprite[i].extra > 0) switch (sprite[i].picnum) + if (actor->s.extra > 0) switch (actor->s.picnum) { case COOT: // LIZTROOP if (!isRRRA() && (krand() & 3) == 2) - S_PlayActorSound(PRED_RECOG, i); + S_PlayActorSound(PRED_RECOG, actor); break; case BILLYCOCK: case BILLYRAY: case BRAYSNIPER: // PIGCOP - S_PlayActorSound(PIG_RECOG, i); + S_PlayActorSound(PIG_RECOG, actor); break; } } @@ -606,7 +606,7 @@ void movefta_r(void) if (actorflag(spriteNum, SFLAG_USEACTIVATOR) && sector[sprite[spriteNum].sectnum].lotag & 16384) break; #endif hittype[i].timetosleep = 0; - fi.check_fta_sounds(i); + check_fta_sounds_r(&hittype[i]); changespritestat(i, STAT_ACTOR); break; } @@ -624,7 +624,7 @@ void movefta_r(void) if (wakeup(i, p)) { hittype[i].timetosleep = 0; - fi.check_fta_sounds(i); + check_fta_sounds_r(&hittype[i]); changespritestat(i, STAT_ACTOR); } } diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index 7e5d48aa9..e0860c3ba 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -88,8 +88,6 @@ void move_d(int g_i, int g_p, int g_x); void move_r(int g_i, int g_p, int g_x); int spawn_d(int j, int pn); int spawn_r(int j, int pn); -void check_fta_sounds_d(int i); -void check_fta_sounds_r(int i); void incur_damage_d(struct player_struct* p); void incur_damage_r(struct player_struct* p); void shoot_d(int i, int atwith); @@ -161,7 +159,6 @@ void SetDispatcher() checktimetosleep_d, move_d, spawn_d, - check_fta_sounds_d, incur_damage_d, shoot_d, @@ -212,7 +209,6 @@ void SetDispatcher() checktimetosleep_r, move_r, spawn_r, - check_fta_sounds_r, incur_damage_r, shoot_r, diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index 5b07ea072..f929580db 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -101,7 +101,6 @@ struct Dispatcher void (*checktimetosleep)(int g_i); void (*move)(int g_i, int g_p, int g_x); int (*spawn)(int j, int pn); - void (*check_fta_sounds)(int i); // player void (*incur_damage)(struct player_struct* p); diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 62e9df2f8..5dc2b4235 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -95,6 +95,9 @@ void handle_se128(DDukeActor* i); void handle_se130(DDukeActor* i, int countmax, int EXPLOSION2); void respawn_rrra(DDukeActor* oldact, DDukeActor* newact); +// This is only called from game specific code so it does not need an indirection. +void check_fta_sounds_d(DDukeActor* i); +void check_fta_sounds_r(DDukeActor* i); int dodge(DDukeActor*); void alterang(int ang, DDukeActor* actor, int g_p); diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 4992331df..c59b09a56 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -3991,7 +3991,7 @@ HORIZONLY: if (sprite[var60].picnum == BILLYRAY) S_PlayActorSound(404, var60); else - fi.check_fta_sounds(var60); + check_fta_sounds_r(&hittype[var60]); changespritestat(var60, 1); } } diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index 052392f20..8409ae58c 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -106,7 +106,7 @@ int spawn_d(int j, int pn) if (j >= 0) { hittype[i].timetosleep = 0; - fi.check_fta_sounds(i); + check_fta_sounds_d(&hittype[i]); changespritestat(i, 1); } else changespritestat(i, 2); @@ -879,7 +879,7 @@ int spawn_d(int j, int pn) if(j >= 0) { hittype[i].timetosleep = 0; - fi.check_fta_sounds(i); + check_fta_sounds_d(&hittype[i]); changespritestat(i,1); } else changespritestat(i,2); diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index b04b9894a..b3d250bb9 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -1049,7 +1049,7 @@ int spawn_r(int j, int pn) if(j >= 0) { hittype[i].timetosleep = 0; - fi.check_fta_sounds(i); + check_fta_sounds_r(&hittype[i]); changespritestat(i,1); } else changespritestat(i,2);