From ecdc92e6b9cf74968ee5144f40d2173a8f197079 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 27 Jul 2020 20:53:31 +0200 Subject: [PATCH] - copied some changes to kill count management from DukeGDX. --- source/games/duke/src/actors_d.cpp | 3 ++- source/games/duke/src/dispatch.cpp | 1 + source/games/duke/src/flags_d.cpp | 1 + source/games/duke/src/flags_r.cpp | 1 + source/games/duke/src/gameexec.cpp | 11 ++++++++++- source/games/duke/src/names.h | 1 + source/games/duke/src/spawn_d.cpp | 5 ++++- 7 files changed, 20 insertions(+), 3 deletions(-) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 302a717ab..63620aef7 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -2445,6 +2445,7 @@ static void greenslime(int i) int k = EGS(sprite[i].sectnum, sprite[i].x, sprite[i].y, sprite[i].z, GLASSPIECES + (j % 3), -32, 36, 36, krand() & 2047, 32 + (krand() & 63), 1024 - (krand() & 1023), i, 5); sprite[k].pal = 1; } + ps[p].actors_killed++; S_PlayActorSound(GLASS_BREAKING, i); deletesprite(i); } @@ -2575,7 +2576,6 @@ static void greenslime(int i) { S_PlayActorSound(SLIM_DYING, i); - ps[p].actors_killed++; if (ps[p].somethingonplayer == i) ps[p].somethingonplayer = -1; @@ -2584,6 +2584,7 @@ static void greenslime(int i) S_PlayActorSound(SOMETHINGFROZE, i); t[0] = -5; t[3] = 0; return; } + ps[p].actors_killed++; if ((krand() & 255) < 32) { diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index b48c9480b..f3d299a95 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -284,5 +284,6 @@ int TILE_CROSSHAIR; int TILE_BIGORBIT1; int TILE_HURTRAIL; int TILE_FLOORPLASMA; +int TILE_EGG; END_DUKE_NS diff --git a/source/games/duke/src/flags_d.cpp b/source/games/duke/src/flags_d.cpp index 095793569..f68ac40d5 100644 --- a/source/games/duke/src/flags_d.cpp +++ b/source/games/duke/src/flags_d.cpp @@ -281,6 +281,7 @@ void initactorflags_d() TILE_BIGORBIT1 = BIGORBIT1; TILE_HURTRAIL = HURTRAIL; TILE_FLOORPLASMA = FLOORPLASMA; + TILE_EGG = EGG; } diff --git a/source/games/duke/src/flags_r.cpp b/source/games/duke/src/flags_r.cpp index 06426c60a..d4dd3dbe6 100644 --- a/source/games/duke/src/flags_r.cpp +++ b/source/games/duke/src/flags_r.cpp @@ -251,6 +251,7 @@ void initactorflags_r() TILE_BIGORBIT1 = BIGORBIT1; TILE_HURTRAIL = HURTRAIL; TILE_FLOORPLASMA = FLOORPLASMA; + TILE_EGG = EGG; PHEIGHT = PHEIGHT_RR; } diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 82f553fc3..751f79814 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -439,7 +439,16 @@ int ParseState::parse(void) insptr++; if (g_sp->picnum == TILE_APLAYER) g_sp->pal = ps[g_sp->yvel].palookup; - else g_sp->pal = hittype[g_i].tempang; + else + { + // Copied from DukeGDX. + if (g_sp->picnum == TILE_EGG && hittype[g_i].temp_data[5] == TILE_EGG + 2 && g_sp->pal == 1) + { + ps[connecthead].max_actors_killed++; //revive the egg + hittype[g_i].temp_data[5] = 0; + } + g_sp->pal = hittype[g_i].tempang; + } hittype[g_i].tempang = 0; break; case concmd_tossweapon: diff --git a/source/games/duke/src/names.h b/source/games/duke/src/names.h index 760545950..1470010a2 100644 --- a/source/games/duke/src/names.h +++ b/source/games/duke/src/names.h @@ -54,6 +54,7 @@ extern int TILE_CROSSHAIR; extern int TILE_BIGORBIT1; extern int TILE_HURTRAIL; extern int TILE_FLOORPLASMA; +extern int TILE_EGG; diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index 43eb3430a..40f66482b 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -1164,8 +1164,11 @@ int spawn_d(int j, int pn) } else { - if(sp->picnum == EGG) + if (sp->picnum == EGG) + { sp->clipdist = 24; + ps[connecthead].max_actors_killed++; + } sp->cstat = 257|(krand()&4); changespritestat(i,2); }