From 669fcc967fd89038cb329c43bad6c1cf33599b69 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 23 Oct 2020 20:07:26 +0200 Subject: [PATCH] - cheats.cpp and ccmds.cpp handled. # Conflicts: # source/games/duke/src/cheats.cpp --- source/games/duke/src/actors_r.cpp | 2 +- source/games/duke/src/ccmds.cpp | 15 ++++++++------- source/games/duke/src/cheats.cpp | 12 ++++++------ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 8587647d1..50b336b8b 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1624,7 +1624,7 @@ void movetransports_r(void) spawn(act, TRANSPORTERBEAM); S_PlayActorSound(TELEPORTER, act); - for (k = connecthead; k >= 0; k = connectpoint2[k])// connectpoinhittype[i].temp_data[1][k]) + for (k = connecthead; k >= 0; k = connectpoint2[k]) if (ps[k].cursectnum == Owner->s.sectnum) { ps[k].frag_ps = p; diff --git a/source/games/duke/src/ccmds.cpp b/source/games/duke/src/ccmds.cpp index 07a98bd6e..f082ec62e 100644 --- a/source/games/duke/src/ccmds.cpp +++ b/source/games/duke/src/ccmds.cpp @@ -46,7 +46,7 @@ static int ccmd_spawn(CCmdFuncPtr parm) unsigned int cstat = 0, picnum = 0; unsigned int pal = 0; int ang = 0; - int set = 0, idx; + int set = 0; #if 0 // fixme - route through the network and this limitation becomes irrelevant if (netgame || numplayers > 1 || !(ps[myconnectindex].gm & MODE_GAME)) { @@ -88,14 +88,15 @@ static int ccmd_spawn(CCmdFuncPtr parm) return CCMD_SHOWHELP; } - idx = fi.spawn(ps[myconnectindex].i, (short)picnum); - if (set & 1) sprite[idx].pal = (char)pal; - if (set & 2) sprite[idx].cstat = (short)cstat; - if (set & 4) sprite[idx].ang = ang; + auto spawned = spawn(ps[myconnectindex].GetActor(), picnum); + if (set & 1) spawned->s.pal = (char)pal; + if (set & 2) spawned->s.cstat = (short)cstat; + if (set & 4) spawned->s.ang = ang; if (set & 8) { - if (setsprite(idx, x, y, z) < 0) { + if (setsprite(spawned, x, y, z) < 0) + { Printf("spawn: Sprite can't be spawned into null space\n"); - deletesprite(idx); + deletesprite(spawned); } } diff --git a/source/games/duke/src/cheats.cpp b/source/games/duke/src/cheats.cpp index dfe7362ad..ec410a96c 100644 --- a/source/games/duke/src/cheats.cpp +++ b/source/games/duke/src/cheats.cpp @@ -118,10 +118,10 @@ static const char *cheatKfc(int player) { for (int i = 0; i < 7; i++) { - int spr = fi.spawn(ps[player].i, TILE_HEN); - sprite[spr].pal = 1; - sprite[spr].xrepeat = sprite[spr].xrepeat << 2; - sprite[spr].yrepeat = sprite[spr].yrepeat << 2; + auto spr = spawn(ps[player].GetActor(), TILE_HEN); + spr->s.pal = 1; + spr->s.xrepeat = spr->s.xrepeat << 2; + spr->s.yrepeat = spr->s.yrepeat << 2; } return quoteMgr.GetQuote(QUOTE_CHEAT_KFC); } @@ -195,7 +195,7 @@ const char* GameInterface::GenericCheat(int player, int cheat) ps[player].gotweapon.Zero(); ps[player].curr_weapon = KNEE_WEAPON; ps[player].nocheat = 1; - sprite[ps[player].i].extra = 1; + ps[player].GetActor()->s.extra = 1; return quoteMgr.GetQuote(QUOTE_YERFUCKED); case CHT_AARON: @@ -486,7 +486,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip) break; case GIVE_HEALTH: - sprite[ps[player].i].extra = max_player_health << 1; + ps[player].GetActor()->s.extra = max_player_health << 1; break; case GIVE_WEAPONS: