diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index a7d3bf73b..2cb487983 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -710,8 +710,6 @@ set( NOT_COMPILED_SOURCE_FILES games/duke/src/cheats.cpp games/duke/src/dispatch.cpp games/duke/src/d_menu.cpp - games/duke/src/flags_d.cpp - games/duke/src/flags_r.cpp games/duke/src/game.cpp games/duke/src/gamedef.cpp games/duke/src/gameexec.cpp diff --git a/source/core/actorinfo.h b/source/core/actorinfo.h index cd93206f2..f4eacbe04 100644 --- a/source/core/actorinfo.h +++ b/source/core/actorinfo.h @@ -26,6 +26,12 @@ struct FActorInfo PClassActor *Replacee = nullptr; DVector2 DefaultScale = { 0, 0 }; int TypeNum = -1; // game specific identifier. + int FirstAction = -1; + int NumActions = 0; + int FirstMove = -1; + int NumMoves = 0; + int FirstAI = -1; + int NumAIs = 0; int DefaultFlags = 0; int DefaultCstat = 0; FName DamageType = NAME_None; // damage type this item inflicts diff --git a/source/games/duke/all_d.cpp b/source/games/duke/all_d.cpp index 7e08114b2..a60dc55a9 100644 --- a/source/games/duke/all_d.cpp +++ b/source/games/duke/all_d.cpp @@ -1,6 +1,5 @@ #include "src/actors_d.cpp" #include "src/animatesprites_d.cpp" -#include "src/flags_d.cpp" #include "src/hudweapon_d.cpp" #include "src/player_d.cpp" #include "src/player_w.cpp" diff --git a/source/games/duke/all_r.cpp b/source/games/duke/all_r.cpp index 09b4cb3e2..958b8005e 100644 --- a/source/games/duke/all_r.cpp +++ b/source/games/duke/all_r.cpp @@ -2,7 +2,6 @@ #include "src/actors_lava.cpp" #include "src/animatesprites_r.cpp" #include "src/bowling.cpp" -#include "src/flags_r.cpp" #include "src/hudweapon_r.cpp" #include "src/player_r.cpp" #include "src/premap_r.cpp" diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index b6a66f9c1..eb60a33a4 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -32,9 +32,6 @@ BEGIN_DUKE_NS // //--------------------------------------------------------------------------- -void initactorflags_d(); -void initactorflags_r(); - bool checkaccessswitch_d(int snum, int pal, DDukeActor *act, walltype* w); bool checkaccessswitch_r(int snum, int pal, DDukeActor* act, walltype* w); void activatebysector_d(sectortype* sect, DDukeActor* j); @@ -76,7 +73,6 @@ void SetDispatcher() fi = { think_d, movetransports_d, - initactorflags_d, checkaccessswitch_d, activatebysector_d, checksectors_d, @@ -99,7 +95,6 @@ void SetDispatcher() fi = { think_r, movetransports_r, - initactorflags_r, checkaccessswitch_r, activatebysector_r, checksectors_r, diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index 67c02ddcd..024876a2d 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -74,7 +74,6 @@ struct Dispatcher // sectors_?.cpp void (*think)(); void (*movetransports)(); - void (*initactorflags)(); bool (*checkaccessswitch)(int snum, int switchpal, DDukeActor* act, walltype* w); void (*activatebysector)(sectortype* sect, DDukeActor* j); void (*checksectors)(int low); diff --git a/source/games/duke/src/flags_d.cpp b/source/games/duke/src/flags_d.cpp deleted file mode 100644 index ce3b6f0ad..000000000 --- a/source/games/duke/src/flags_d.cpp +++ /dev/null @@ -1,60 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 1996, 2003 - 3D Realms Entertainment -Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements) -Copyright (C) 2020 - Christoph Oelckers - -This file is part of Enhanced Duke Nukem 3D version 1.5 - Atomic Edition - -Duke Nukem 3D is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Original Source: 1996 - Todd Replogle -Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms - -EDuke enhancements integrated: 04/13/2003 - Matt Saettler - -Note: EDuke source was in transition. Changes are in-progress in the -source as it is released. - -*/ -//------------------------------------------------------------------------- - -#include "ns.h" -#include "global.h" - -BEGIN_DUKE_NS - -void initactorflags_d() -{ - gs.weaponsandammosprites[0] = DukeRPGSpriteClass; - gs.weaponsandammosprites[1] = DukeChaingunSpriteClass; - gs.weaponsandammosprites[2] = DukeDevastatorAmmoClass; - gs.weaponsandammosprites[3] = DukeRPGAmmoClass; - gs.weaponsandammosprites[4] = DukeRPGAmmoClass; - gs.weaponsandammosprites[5] = DukeJetpackClass; - gs.weaponsandammosprites[6] = DukeShieldClass; - gs.weaponsandammosprites[7] = DukeFirstAidClass; - gs.weaponsandammosprites[8] = DukeSteroidsClass; - gs.weaponsandammosprites[9] = DukeRPGAmmoClass; - gs.weaponsandammosprites[10] = DukeRPGAmmoClass; - gs.weaponsandammosprites[11] = DukeRPGSpriteClass; - gs.weaponsandammosprites[12] = DukeRPGAmmoClass; - gs.weaponsandammosprites[13] = DukeFreezeSpriteClass; - gs.weaponsandammosprites[14] = DukeFreezeAmmoClass; -} - - -END_DUKE_NS diff --git a/source/games/duke/src/flags_r.cpp b/source/games/duke/src/flags_r.cpp deleted file mode 100644 index a30a70f00..000000000 --- a/source/games/duke/src/flags_r.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 1996, 2003 - 3D Realms Entertainment -Copyright (C) 2017-2019 Nuke.YKT -Copyright (C) 2020 - Christoph Oelckers - -This file is part of Duke Nukem 3D version 1.5 - Atomic Edition - -Duke Nukem 3D is free software, you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation, either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY, without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program, if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -Original Source, 1996 - Todd Replogle -Prepared for public release, 03/21/2003 - Charlie Wiederhold, 3D Realms -*/ -//------------------------------------------------------------------------- - -#include "ns.h" -#include "global.h" - -BEGIN_DUKE_NS - -void initactorflags_r() -{ - gs.weaponsandammosprites[0] = RedneckCrossbowClass; - gs.weaponsandammosprites[1] = RedneckRiflegunClass; - gs.weaponsandammosprites[2] = RedneckBlasterammoClass; - gs.weaponsandammosprites[3] = RedneckDynamiteAmmoClass; - gs.weaponsandammosprites[4] = RedneckDynamiteAmmoClass; - gs.weaponsandammosprites[5] = RedneckCowpieClass; - gs.weaponsandammosprites[6] = RedneckWhiskeyClass; - gs.weaponsandammosprites[7] = RedneckPorkRindsClass; - gs.weaponsandammosprites[8] = RedneckMoonshineClass; - gs.weaponsandammosprites[9] = RedneckDynamiteAmmoClass; - gs.weaponsandammosprites[10] = RedneckDynamiteAmmoClass; - gs.weaponsandammosprites[11] = RedneckCrossbowClass; - gs.weaponsandammosprites[12] = RedneckDynamiteAmmoClass; - gs.weaponsandammosprites[13] = RedneckTitgunClass; - gs.weaponsandammosprites[14] = RedneckTitAmmoClass; - - gs.gutsscale = 0.125; -} - -END_DUKE_NS diff --git a/source/games/duke/src/game.cpp b/source/games/duke/src/game.cpp index 487aa589a..75e8365bc 100644 --- a/source/games/duke/src/game.cpp +++ b/source/games/duke/src/game.cpp @@ -324,6 +324,55 @@ void setTextureIDs() foftex = tileGetTextureID(FOF); } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void initactorflags() +{ + if (!isRR()) + { + gs.weaponsandammosprites[0] = DukeRPGSpriteClass; + gs.weaponsandammosprites[1] = DukeChaingunSpriteClass; + gs.weaponsandammosprites[2] = DukeDevastatorAmmoClass; + gs.weaponsandammosprites[3] = DukeRPGAmmoClass; + gs.weaponsandammosprites[4] = DukeRPGAmmoClass; + gs.weaponsandammosprites[5] = DukeJetpackClass; + gs.weaponsandammosprites[6] = DukeShieldClass; + gs.weaponsandammosprites[7] = DukeFirstAidClass; + gs.weaponsandammosprites[8] = DukeSteroidsClass; + gs.weaponsandammosprites[9] = DukeRPGAmmoClass; + gs.weaponsandammosprites[10] = DukeRPGAmmoClass; + gs.weaponsandammosprites[11] = DukeRPGSpriteClass; + gs.weaponsandammosprites[12] = DukeRPGAmmoClass; + gs.weaponsandammosprites[13] = DukeFreezeSpriteClass; + gs.weaponsandammosprites[14] = DukeFreezeAmmoClass; + } + else + { + gs.weaponsandammosprites[0] = RedneckCrossbowClass; + gs.weaponsandammosprites[1] = RedneckRiflegunClass; + gs.weaponsandammosprites[2] = RedneckBlasterammoClass; + gs.weaponsandammosprites[3] = RedneckDynamiteAmmoClass; + gs.weaponsandammosprites[4] = RedneckDynamiteAmmoClass; + gs.weaponsandammosprites[5] = RedneckCowpieClass; + gs.weaponsandammosprites[6] = RedneckWhiskeyClass; + gs.weaponsandammosprites[7] = RedneckPorkRindsClass; + gs.weaponsandammosprites[8] = RedneckMoonshineClass; + gs.weaponsandammosprites[9] = RedneckDynamiteAmmoClass; + gs.weaponsandammosprites[10] = RedneckDynamiteAmmoClass; + gs.weaponsandammosprites[11] = RedneckCrossbowClass; + gs.weaponsandammosprites[12] = RedneckDynamiteAmmoClass; + gs.weaponsandammosprites[13] = RedneckTitgunClass; + gs.weaponsandammosprites[14] = RedneckTitAmmoClass; + + gs.gutsscale = 0.125; + } +} + + //--------------------------------------------------------------------------- // // set up the game module's state @@ -371,7 +420,7 @@ void GameInterface::app_init() SetDispatcher(); loadcons(); - fi.initactorflags(); + initactorflags(); setTextureIDs(); // sets a few texture IDs needed for map checking. duke_menufont->Callback(); // depends on the .CON files so it must be after loadcons @@ -669,6 +718,7 @@ DEFINE_PROPERTY(setgamedefaults, 0, DukeActor) DEFINE_PROPERTY(move, Sii, DukeActor) { + if (info->ActorInfo()->NumMoves++ == 0) info->ActorInfo()->FirstMove = moves.Size(); auto move = &moves[moves.Reserve(1)]; move->movex = move->movez = 0; PROP_STRING_PARM(n, 0); @@ -688,6 +738,7 @@ DEFINE_PROPERTY(move, Sii, DukeActor) DEFINE_PROPERTY(movef, Sff, DukeActor) { + if (info->ActorInfo()->NumMoves++ == 0) info->ActorInfo()->FirstMove = moves.Size(); auto move = &moves[moves.Reserve(1)]; move->movex = move->movez = 0; PROP_STRING_PARM(n, 0); @@ -707,6 +758,7 @@ DEFINE_PROPERTY(movef, Sff, DukeActor) DEFINE_PROPERTY(action, SZIiiii, DukeActor) { + if (info->ActorInfo()->NumActions++ == 0) info->ActorInfo()->FirstAction = actions.Size(); auto action = &actions[actions.Reserve(1)]; memset(action, 0, sizeof(*action)); PROP_STRING_PARM(n, 0); @@ -741,6 +793,7 @@ DEFINE_PROPERTY(action, SZIiiii, DukeActor) DEFINE_PROPERTY(ai, SSSi, DukeActor) { + if (info->ActorInfo()->NumAIs++ == 0) info->ActorInfo()->FirstAI = ais.Size(); auto ai = &ais[ais.Reserve(1)]; ai->moveflags = 0; PROP_STRING_PARM(n, 0); @@ -748,7 +801,7 @@ DEFINE_PROPERTY(ai, SSSi, DukeActor) PROP_STRING_PARM(a, 1); ai->action = FName(a).GetIndex() | 0x80000000; // don't look it up yet. PROP_STRING_PARM(m, 2); - ai->action = FName(m).GetIndex() | 0x80000000; // don't look it up yet. + ai->move = FName(m).GetIndex() | 0x80000000; // don't look it up yet. if (PROP_PARM_COUNT > 3) { PROP_INT_PARM(v3, 3);