- check_fta_sounds.

This commit is contained in:
Christoph Oelckers 2020-10-22 19:08:10 +02:00
parent b9aa5de217
commit 4c9655b110
8 changed files with 30 additions and 33 deletions

View file

@ -73,13 +73,13 @@ void SerializeActorGlobals(FSerializer& arc)
{ {
fire.Clear(); fire.Clear();
if (!res) return; if (!res) return;
auto length = arc.ArraySize() / 2; int length = arc.ArraySize() / 2;
int key; int key;
FireProj value; FireProj value;
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
{ {
Serialize(arc, nullptr, key, nullptr); arc(nullptr, key);
Serialize(arc, nullptr, value, nullptr); Serialize(arc, nullptr, value, nullptr);
fire.Insert(key, value); 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 (actor->s.extra > 0) switch (actor->s.picnum)
if (spri->extra > 0) switch (spri->picnum)
{ {
case LIZTROOPONTOILET: case LIZTROOPONTOILET:
case LIZTROOPJUSTSIT: case LIZTROOPJUSTSIT:
@ -156,56 +155,56 @@ void check_fta_sounds_d(int i)
case LIZTROOPDUCKING: case LIZTROOPDUCKING:
case LIZTROOPRUNNING: case LIZTROOPRUNNING:
case LIZTROOP: case LIZTROOP:
S_PlayActorSound(PRED_RECOG, i); S_PlayActorSound(PRED_RECOG, actor);
break; break;
case LIZMAN: case LIZMAN:
case LIZMANSPITTING: case LIZMANSPITTING:
case LIZMANFEEDING: case LIZMANFEEDING:
case LIZMANJUMP: case LIZMANJUMP:
S_PlayActorSound(CAPT_RECOG, i); S_PlayActorSound(CAPT_RECOG, actor);
break; break;
case PIGCOP: case PIGCOP:
case PIGCOPDIVE: case PIGCOPDIVE:
S_PlayActorSound(PIG_RECOG, i); S_PlayActorSound(PIG_RECOG, actor);
break; break;
case RECON: case RECON:
S_PlayActorSound(RECO_RECOG, i); S_PlayActorSound(RECO_RECOG, actor);
break; break;
case DRONE: case DRONE:
S_PlayActorSound(DRON_RECOG, i); S_PlayActorSound(DRON_RECOG, actor);
break; break;
case COMMANDER: case COMMANDER:
case COMMANDERSTAYPUT: case COMMANDERSTAYPUT:
S_PlayActorSound(COMM_RECOG, i); S_PlayActorSound(COMM_RECOG, actor);
break; break;
case ORGANTIC: case ORGANTIC:
S_PlayActorSound(TURR_RECOG, i); S_PlayActorSound(TURR_RECOG, actor);
break; break;
case OCTABRAIN: case OCTABRAIN:
case OCTABRAINSTAYPUT: case OCTABRAINSTAYPUT:
S_PlayActorSound(OCTA_RECOG, i); S_PlayActorSound(OCTA_RECOG, actor);
break; break;
case BOSS1: case BOSS1:
S_PlaySound(BOS1_RECOG); S_PlaySound(BOS1_RECOG);
break; break;
case BOSS2: case BOSS2:
if (spri->pal == 1) if (actor->s.pal == 1)
S_PlaySound(BOS2_RECOG); S_PlaySound(BOS2_RECOG);
else S_PlaySound(WHIPYOURASS); else S_PlaySound(WHIPYOURASS);
break; break;
case BOSS3: case BOSS3:
if (spri->pal == 1) if (actor->s.pal == 1)
S_PlaySound(BOS3_RECOG); S_PlaySound(BOS3_RECOG);
else S_PlaySound(RIPHEADNECK); else S_PlaySound(RIPHEADNECK);
break; break;
case BOSS4: case BOSS4:
case BOSS4STAYPUT: case BOSS4STAYPUT:
if (spri->pal == 1) if (actor->s.pal == 1)
S_PlaySound(BOS4_RECOG); S_PlaySound(BOS4_RECOG);
S_PlaySound(BOSS4_FIRSTSEE); S_PlaySound(BOSS4_FIRSTSEE);
break; break;
case GREENSLIME: case GREENSLIME:
S_PlayActorSound(SLIM_RECOG, i); S_PlayActorSound(SLIM_RECOG, actor);
break; break;
} }
} }
@ -781,7 +780,7 @@ void movefta_d(void)
default: default:
ht->timetosleep = 0; ht->timetosleep = 0;
fi.check_fta_sounds(i); check_fta_sounds_d(&hittype[i]);
changespritestat(i, STAT_ACTOR); changespritestat(i, STAT_ACTOR);
break; break;
} }

View file

@ -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 case COOT: // LIZTROOP
if (!isRRRA() && (krand() & 3) == 2) if (!isRRRA() && (krand() & 3) == 2)
S_PlayActorSound(PRED_RECOG, i); S_PlayActorSound(PRED_RECOG, actor);
break; break;
case BILLYCOCK: case BILLYCOCK:
case BILLYRAY: case BILLYRAY:
case BRAYSNIPER: // PIGCOP case BRAYSNIPER: // PIGCOP
S_PlayActorSound(PIG_RECOG, i); S_PlayActorSound(PIG_RECOG, actor);
break; break;
} }
} }
@ -606,7 +606,7 @@ void movefta_r(void)
if (actorflag(spriteNum, SFLAG_USEACTIVATOR) && sector[sprite[spriteNum].sectnum].lotag & 16384) break; if (actorflag(spriteNum, SFLAG_USEACTIVATOR) && sector[sprite[spriteNum].sectnum].lotag & 16384) break;
#endif #endif
hittype[i].timetosleep = 0; hittype[i].timetosleep = 0;
fi.check_fta_sounds(i); check_fta_sounds_r(&hittype[i]);
changespritestat(i, STAT_ACTOR); changespritestat(i, STAT_ACTOR);
break; break;
} }
@ -624,7 +624,7 @@ void movefta_r(void)
if (wakeup(i, p)) if (wakeup(i, p))
{ {
hittype[i].timetosleep = 0; hittype[i].timetosleep = 0;
fi.check_fta_sounds(i); check_fta_sounds_r(&hittype[i]);
changespritestat(i, STAT_ACTOR); changespritestat(i, STAT_ACTOR);
} }
} }

View file

@ -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); void move_r(int g_i, int g_p, int g_x);
int spawn_d(int j, int pn); int spawn_d(int j, int pn);
int spawn_r(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_d(struct player_struct* p);
void incur_damage_r(struct player_struct* p); void incur_damage_r(struct player_struct* p);
void shoot_d(int i, int atwith); void shoot_d(int i, int atwith);
@ -161,7 +159,6 @@ void SetDispatcher()
checktimetosleep_d, checktimetosleep_d,
move_d, move_d,
spawn_d, spawn_d,
check_fta_sounds_d,
incur_damage_d, incur_damage_d,
shoot_d, shoot_d,
@ -212,7 +209,6 @@ void SetDispatcher()
checktimetosleep_r, checktimetosleep_r,
move_r, move_r,
spawn_r, spawn_r,
check_fta_sounds_r,
incur_damage_r, incur_damage_r,
shoot_r, shoot_r,

View file

@ -101,7 +101,6 @@ struct Dispatcher
void (*checktimetosleep)(int g_i); void (*checktimetosleep)(int g_i);
void (*move)(int g_i, int g_p, int g_x); void (*move)(int g_i, int g_p, int g_x);
int (*spawn)(int j, int pn); int (*spawn)(int j, int pn);
void (*check_fta_sounds)(int i);
// player // player
void (*incur_damage)(struct player_struct* p); void (*incur_damage)(struct player_struct* p);

View file

@ -95,6 +95,9 @@ void handle_se128(DDukeActor* i);
void handle_se130(DDukeActor* i, int countmax, int EXPLOSION2); void handle_se130(DDukeActor* i, int countmax, int EXPLOSION2);
void respawn_rrra(DDukeActor* oldact, DDukeActor* newact); 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*); int dodge(DDukeActor*);
void alterang(int ang, DDukeActor* actor, int g_p); void alterang(int ang, DDukeActor* actor, int g_p);

View file

@ -3991,7 +3991,7 @@ HORIZONLY:
if (sprite[var60].picnum == BILLYRAY) if (sprite[var60].picnum == BILLYRAY)
S_PlayActorSound(404, var60); S_PlayActorSound(404, var60);
else else
fi.check_fta_sounds(var60); check_fta_sounds_r(&hittype[var60]);
changespritestat(var60, 1); changespritestat(var60, 1);
} }
} }

View file

@ -106,7 +106,7 @@ int spawn_d(int j, int pn)
if (j >= 0) { if (j >= 0) {
hittype[i].timetosleep = 0; hittype[i].timetosleep = 0;
fi.check_fta_sounds(i); check_fta_sounds_d(&hittype[i]);
changespritestat(i, 1); changespritestat(i, 1);
} else } else
changespritestat(i, 2); changespritestat(i, 2);
@ -879,7 +879,7 @@ int spawn_d(int j, int pn)
if(j >= 0) if(j >= 0)
{ {
hittype[i].timetosleep = 0; hittype[i].timetosleep = 0;
fi.check_fta_sounds(i); check_fta_sounds_d(&hittype[i]);
changespritestat(i,1); changespritestat(i,1);
} }
else changespritestat(i,2); else changespritestat(i,2);

View file

@ -1049,7 +1049,7 @@ int spawn_r(int j, int pn)
if(j >= 0) if(j >= 0)
{ {
hittype[i].timetosleep = 0; hittype[i].timetosleep = 0;
fi.check_fta_sounds(i); check_fta_sounds_r(&hittype[i]);
changespritestat(i,1); changespritestat(i,1);
} }
else changespritestat(i,2); else changespritestat(i,2);