mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- copy the CON defined info into the actual actors.
Only using the strength value right now.
This commit is contained in:
parent
8c831de9be
commit
ebf7b4a121
10 changed files with 69 additions and 21 deletions
|
@ -25,10 +25,9 @@ struct FActorInfo
|
||||||
PClassActor *Replacement = nullptr;
|
PClassActor *Replacement = nullptr;
|
||||||
PClassActor *Replacee = nullptr;
|
PClassActor *Replacee = nullptr;
|
||||||
DVector2 DefaultScale = { 0, 0 };
|
DVector2 DefaultScale = { 0, 0 };
|
||||||
int TypeNum = -1;
|
int TypeNum = -1; // game specific identifier.
|
||||||
int DefaultFlags = 0;
|
int DefaultFlags = 0;
|
||||||
int DefaultCstat = 0;
|
int DefaultCstat = 0;
|
||||||
int Health = 0; // not used yet - this will stand in if no CON defines a health value for Duke.
|
|
||||||
FName DamageType = NAME_None; // damage type this item inflicts
|
FName DamageType = NAME_None; // damage type this item inflicts
|
||||||
|
|
||||||
// these are temporary. Due to how Build games handle their tiles, we cannot look up the textures when scripts are being parsed.
|
// these are temporary. Due to how Build games handle their tiles, we cannot look up the textures when scripts are being parsed.
|
||||||
|
|
|
@ -1182,6 +1182,7 @@ int RunGame()
|
||||||
D_CheckNetGame();
|
D_CheckNetGame();
|
||||||
UpdateGenericUI(ui_generic);
|
UpdateGenericUI(ui_generic);
|
||||||
PClassActor::StaticInit();
|
PClassActor::StaticInit();
|
||||||
|
gi->FinalizeSetup();
|
||||||
MainLoop();
|
MainLoop();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@ struct GameInterface
|
||||||
virtual ~GameInterface() {}
|
virtual ~GameInterface() {}
|
||||||
virtual bool GenerateSavePic() { return false; }
|
virtual bool GenerateSavePic() { return false; }
|
||||||
virtual void app_init() = 0;
|
virtual void app_init() = 0;
|
||||||
|
virtual void FinalizeSetup() {}
|
||||||
virtual void LoadTextureInfo(TilesetBuildInfo& info) {}
|
virtual void LoadTextureInfo(TilesetBuildInfo& info) {}
|
||||||
virtual void SetupSpecialTextures(TilesetBuildInfo&) = 0;
|
virtual void SetupSpecialTextures(TilesetBuildInfo&) = 0;
|
||||||
virtual void loadPalette() = 0;
|
virtual void loadPalette() = 0;
|
||||||
|
|
|
@ -72,3 +72,4 @@ xx(spawnsound)
|
||||||
xx(gutsoffset)
|
xx(gutsoffset)
|
||||||
xx(falladjustz)
|
xx(falladjustz)
|
||||||
xx(aimoffset)
|
xx(aimoffset)
|
||||||
|
xx(strength)
|
||||||
|
|
|
@ -382,17 +382,7 @@ DEFINE_PROPERTY(spritesetindex, I, CoreActor)
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//==========================================================================
|
// Sets up the flag defaults which differ between RR and Duke.
|
||||||
DEFINE_PROPERTY(health, I, CoreActor)
|
|
||||||
{
|
|
||||||
PROP_INT_PARM(i, 0);
|
|
||||||
bag.Info->ActorInfo()->Health = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// This is a hack because the FTA sight flag has different defaults in
|
|
||||||
// Duke and RR.
|
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
DEFINE_PROPERTY(lookallarounddefault,0, DukeActor)
|
DEFINE_PROPERTY(lookallarounddefault,0, DukeActor)
|
||||||
|
|
|
@ -25,6 +25,7 @@ struct GameInterface : public ::GameInterface
|
||||||
{
|
{
|
||||||
const char* Name() override { return "Duke"; }
|
const char* Name() override { return "Duke"; }
|
||||||
void app_init() override;
|
void app_init() override;
|
||||||
|
void FinalizeSetup() override;
|
||||||
void loadPalette() override;
|
void loadPalette() override;
|
||||||
void SetupSpecialTextures(TilesetBuildInfo& info) override;
|
void SetupSpecialTextures(TilesetBuildInfo& info) override;
|
||||||
bool GenerateSavePic() override;
|
bool GenerateSavePic() override;
|
||||||
|
|
|
@ -44,6 +44,7 @@ Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
#include "thingdef.h"
|
#include "thingdef.h"
|
||||||
#include "tilesetbuilder.h"
|
#include "tilesetbuilder.h"
|
||||||
|
#include "concmd.h"
|
||||||
|
|
||||||
BEGIN_DUKE_NS
|
BEGIN_DUKE_NS
|
||||||
|
|
||||||
|
@ -424,6 +425,63 @@ void GameInterface::app_init()
|
||||||
S_ParseDeveloperCommentary();
|
S_ParseDeveloperCommentary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameInterface::FinalizeSetup()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < MAXTILES; i++)
|
||||||
|
{
|
||||||
|
auto& actinf = gs.actorinfo[i];
|
||||||
|
if (actinf.scriptaddress != 0)
|
||||||
|
{
|
||||||
|
int act = ScriptCode[actinf.scriptaddress + 1];
|
||||||
|
int cmd = ScriptCode[actinf.scriptaddress + 4];
|
||||||
|
auto info = spawnMap.CheckKey(i);
|
||||||
|
PClassActor* cls = nullptr;
|
||||||
|
|
||||||
|
if (info != nullptr && info->basetex <= 0)
|
||||||
|
{
|
||||||
|
cls = info->cls;
|
||||||
|
}
|
||||||
|
else if (info == nullptr || info->basetex <= 0)
|
||||||
|
{
|
||||||
|
// No unique actor exists here. Since we need one, create a new class here, directly derived from DDukeActor.
|
||||||
|
auto newcls = (PClassActor*)RUNTIME_CLASS(DDukeActor)->CreateDerivedClass(FStringf("NewConActor%d", i), RUNTIME_CLASS(DDukeActor)->Size);
|
||||||
|
newcls->InitializeDefaults();
|
||||||
|
spawnMap.Insert(i, { newcls, -1, -1, NO_SOUND, int8_t(0), int8_t(0), int16_t(0x8000) });
|
||||||
|
cls = newcls;
|
||||||
|
GetDefaultByType(newcls)->spr.picnum = i; // make it show the right pic.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// the ugly case: This tries to replace a variant of a special actor.
|
||||||
|
// All of Duke's entries falling in this category are coded to not execute scripts at all with no possible override.
|
||||||
|
// this means that none of these actors can ever run its scripts.
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// now copy all data over so that we don't have to do double maintenance.
|
||||||
|
if (cls)
|
||||||
|
{
|
||||||
|
cls->ActorInfo()->TypeNum = i;
|
||||||
|
GetDefaultByType(cls)->IntVar(NAME_strength) = ScriptCode[actinf.scriptaddress];
|
||||||
|
if (actinf.enemyflags & EDukeFlags1::FromInt(1))
|
||||||
|
{
|
||||||
|
auto def = static_cast<DDukeActor*>(GetDefaultByType(cls));
|
||||||
|
auto fb = (SFLAG_BADGUY | SFLAG_KILLCOUNT | SFLAG_BADGUYSTAYPUT);
|
||||||
|
auto check = (def->flags1 & (SFLAG_BADGUY | SFLAG_KILLCOUNT));
|
||||||
|
// do not enable KILLCOUNT if it the base is a non-counting badguy. This is needed for RR's animals.
|
||||||
|
if (check == EDukeFlags1::FromInt(SFLAG_BADGUY)) fb &= ~SFLAG_KILLCOUNT;
|
||||||
|
def->flags1 = (def->flags1 & ~fb) | (actinf.enemyflags & fb);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//ScriptCode[actinf.scriptaddress] = 0; // ignore strength values for hashing the script code. (later, we still need this.)
|
||||||
|
// todo: hash the entire script code and compare against precalculated value for the current game.
|
||||||
|
// If identical, remove all ScriptAddresses from the class list.
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CallInitialize(DDukeActor* actor)
|
void CallInitialize(DDukeActor* actor)
|
||||||
{
|
{
|
||||||
|
|
|
@ -126,23 +126,19 @@ DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, PClassActor*
|
||||||
if (gs.actorinfo[s_pn].scriptaddress)
|
if (gs.actorinfo[s_pn].scriptaddress)
|
||||||
{
|
{
|
||||||
auto sa = &ScriptCode[gs.actorinfo[s_pn].scriptaddress];
|
auto sa = &ScriptCode[gs.actorinfo[s_pn].scriptaddress];
|
||||||
act->spr.extra = sa[0];
|
|
||||||
act->curAction = &actions[sa[1]];
|
act->curAction = &actions[sa[1]];
|
||||||
act->curMove = &moves[sa[2]];
|
act->curMove = &moves[sa[2]];
|
||||||
act->spr.hitag = sa[3];
|
act->spr.hitag = sa[3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
act->spr.extra = 0;
|
|
||||||
act->spr.hitag = 0;
|
act->spr.hitag = 0;
|
||||||
}
|
}
|
||||||
|
act->spr.extra = act->IntVar(NAME_strength);
|
||||||
|
|
||||||
if (show2dsector[act->sectno()]) act->spr.cstat2 |= CSTAT2_SPRITE_MAPPED;
|
if (show2dsector[act->sectno()]) act->spr.cstat2 |= CSTAT2_SPRITE_MAPPED;
|
||||||
else act->spr.cstat2 &= ~CSTAT2_SPRITE_MAPPED;
|
else act->spr.cstat2 &= ~CSTAT2_SPRITE_MAPPED;
|
||||||
|
|
||||||
act->sprext = {};
|
|
||||||
act->spsmooth = {};
|
|
||||||
|
|
||||||
return act;
|
return act;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -234,16 +230,15 @@ bool initspriteforspawn(DDukeActor* act)
|
||||||
|
|
||||||
if (act->spr.cstat & CSTAT_SPRITE_BLOCK) act->spr.cstat |= CSTAT_SPRITE_BLOCK_HITSCAN;
|
if (act->spr.cstat & CSTAT_SPRITE_BLOCK) act->spr.cstat |= CSTAT_SPRITE_BLOCK_HITSCAN;
|
||||||
|
|
||||||
|
act->spr.extra = act->IntVar(NAME_strength);
|
||||||
if (gs.actorinfo[s].scriptaddress)
|
if (gs.actorinfo[s].scriptaddress)
|
||||||
{
|
{
|
||||||
act->spr.extra = ScriptCode[gs.actorinfo[s].scriptaddress];
|
|
||||||
act->curAction = &actions[ScriptCode[gs.actorinfo[s].scriptaddress+1]];
|
act->curAction = &actions[ScriptCode[gs.actorinfo[s].scriptaddress+1]];
|
||||||
act->curMove = &moves[ScriptCode[gs.actorinfo[s].scriptaddress+2]];
|
act->curMove = &moves[ScriptCode[gs.actorinfo[s].scriptaddress+2]];
|
||||||
int s3 = ScriptCode[gs.actorinfo[s].scriptaddress+3];
|
int s3 = ScriptCode[gs.actorinfo[s].scriptaddress+3];
|
||||||
if (s3 && act->spr.hitag == 0)
|
if (s3 && act->spr.hitag == 0)
|
||||||
act->spr.hitag = s3;
|
act->spr.hitag = s3;
|
||||||
}
|
}
|
||||||
else act->temp_data[1] = act->temp_data[4] = 0;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class DukeTripBomb : DukeActor
|
||||||
{
|
{
|
||||||
pic "TRIPBOMB";
|
pic "TRIPBOMB";
|
||||||
// Note: The trip bomb has its health defined through CON! Value is 100. Con-based definitions will take precendence.
|
// Note: The trip bomb has its health defined through CON! Value is 100. Con-based definitions will take precendence.
|
||||||
health 100;
|
strength 100;
|
||||||
+CHECKSLEEP;
|
+CHECKSLEEP;
|
||||||
+HITRADIUS_FLAG2;
|
+HITRADIUS_FLAG2;
|
||||||
+MOVEFTA_MAKESTANDABLE;
|
+MOVEFTA_MAKESTANDABLE;
|
||||||
|
|
|
@ -145,11 +145,13 @@ class DukeActor : CoreActor native
|
||||||
meta int gutsoffset;
|
meta int gutsoffset;
|
||||||
meta int falladjustz;
|
meta int falladjustz;
|
||||||
meta int aimoffset;
|
meta int aimoffset;
|
||||||
|
meta int strength;
|
||||||
|
|
||||||
property prefix: none;
|
property prefix: none;
|
||||||
property gutsoffset: gutsoffset;
|
property gutsoffset: gutsoffset;
|
||||||
property falladjustz: falladjustz;
|
property falladjustz: falladjustz;
|
||||||
property aimoffset: aimoffset;
|
property aimoffset: aimoffset;
|
||||||
|
property strength: strength;
|
||||||
|
|
||||||
|
|
||||||
native void SetSpritesetImage(int index);
|
native void SetSpritesetImage(int index);
|
||||||
|
|
Loading…
Reference in a new issue