mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 04:24:39 +00:00
- added a large bunch of script exports.
This commit is contained in:
parent
ba7a0aa83c
commit
a3da3a4c43
17 changed files with 656 additions and 38 deletions
|
@ -270,3 +270,4 @@ xx(BuiltinNameToClass)
|
||||||
xx(BuiltinClassCast)
|
xx(BuiltinClassCast)
|
||||||
|
|
||||||
xx(ScreenJobRunner)
|
xx(ScreenJobRunner)
|
||||||
|
xx(Action)
|
||||||
|
|
|
@ -272,6 +272,13 @@ dottable_id(X) ::= IDENTIFIER(A).
|
||||||
id->Id = A.Name();
|
id->Id = A.Name();
|
||||||
X = id;
|
X = id;
|
||||||
}
|
}
|
||||||
|
// this is needed for defining properties named 'action'.
|
||||||
|
dottable_id(X) ::= ACTION(A).
|
||||||
|
{
|
||||||
|
NEW_AST_NODE(Identifier,id,A);
|
||||||
|
id->Id = NAME_Action;
|
||||||
|
X = id;
|
||||||
|
}
|
||||||
dottable_id(X) ::= dottable_id(A) DOT IDENTIFIER(B).
|
dottable_id(X) ::= dottable_id(A) DOT IDENTIFIER(B).
|
||||||
{
|
{
|
||||||
NEW_AST_NODE(Identifier,id2,A);
|
NEW_AST_NODE(Identifier,id2,A);
|
||||||
|
|
|
@ -100,6 +100,9 @@ struct Baggage
|
||||||
PClassActor *Info;
|
PClassActor *Info;
|
||||||
int Lumpnum;
|
int Lumpnum;
|
||||||
VersionInfo Version;
|
VersionInfo Version;
|
||||||
|
FName DefaultAction;
|
||||||
|
FName DefaultMove;
|
||||||
|
int moveflags;
|
||||||
|
|
||||||
FScriptPosition ScriptPosition;
|
FScriptPosition ScriptPosition;
|
||||||
};
|
};
|
||||||
|
|
|
@ -166,6 +166,18 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Raze, tileflags, raze_tileflags)
|
||||||
ACTION_RETURN_INT(raze_tileflags(which));
|
ACTION_RETURN_INT(raze_tileflags(which));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int raze_tilesurface(int tex)
|
||||||
|
{
|
||||||
|
return tilesurface(FSetTextureID(tex));
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_Raze, tilesurface, raze_tilesurface)
|
||||||
|
{
|
||||||
|
PARAM_PROLOGUE;
|
||||||
|
PARAM_INT(which);
|
||||||
|
ACTION_RETURN_INT(raze_tilesurface(which));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//
|
//
|
||||||
|
@ -185,6 +197,8 @@ DEFINE_FIELD_X(sectortype, sectortype, type)
|
||||||
DEFINE_FIELD_X(sectortype, sectortype, hitag)
|
DEFINE_FIELD_X(sectortype, sectortype, hitag)
|
||||||
DEFINE_FIELD_X(sectortype, sectortype, ceilingheinum)
|
DEFINE_FIELD_X(sectortype, sectortype, ceilingheinum)
|
||||||
DEFINE_FIELD_X(sectortype, sectortype, floorheinum)
|
DEFINE_FIELD_X(sectortype, sectortype, floorheinum)
|
||||||
|
DEFINE_FIELD_X(sectortype, sectortype, ceilingtexture)
|
||||||
|
DEFINE_FIELD_X(sectortype, sectortype, floortexture)
|
||||||
DEFINE_FIELD_X(sectortype, sectortype, extra)
|
DEFINE_FIELD_X(sectortype, sectortype, extra)
|
||||||
DEFINE_FIELD_X(sectortype, sectortype, ceilingshade)
|
DEFINE_FIELD_X(sectortype, sectortype, ceilingshade)
|
||||||
DEFINE_FIELD_X(sectortype, sectortype, ceilingpal)
|
DEFINE_FIELD_X(sectortype, sectortype, ceilingpal)
|
||||||
|
|
|
@ -103,7 +103,7 @@ void addweapon_d(player_struct *p, int weapon, bool wswitch)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool ifsquished(DDukeActor* actor, int p)
|
int ifsquished(DDukeActor* actor, int p)
|
||||||
{
|
{
|
||||||
if (isRR()) return false; // this function is a no-op in RR's source.
|
if (isRR()) return false; // this function is a no-op in RR's source.
|
||||||
|
|
||||||
|
|
|
@ -1485,7 +1485,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fakebubbaspawn(DDukeActor *actor, int g_p)
|
void fakebubbaspawn(DDukeActor *actor, player_struct* p)
|
||||||
{
|
{
|
||||||
fakebubba_spawn++;
|
fakebubba_spawn++;
|
||||||
switch (fakebubba_spawn)
|
switch (fakebubba_spawn)
|
||||||
|
@ -1503,7 +1503,7 @@ void fakebubbaspawn(DDukeActor *actor, int g_p)
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
spawn(actor, RTILE_VIXEN);
|
spawn(actor, RTILE_VIXEN);
|
||||||
operateactivators(666, &ps[g_p]);
|
operateactivators(666, p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,24 +116,24 @@ int setpal(player_struct* p);
|
||||||
int madenoise(int playerNum);
|
int madenoise(int playerNum);
|
||||||
int haskey(sectortype* sect, int snum);
|
int haskey(sectortype* sect, int snum);
|
||||||
void purplelavacheck(player_struct* p);
|
void purplelavacheck(player_struct* p);
|
||||||
bool addphealth(player_struct* p, int amount, bool bigitem);
|
void addphealth(player_struct* p, int amount, bool bigitem);
|
||||||
bool playereat(player_struct* p, int amount, bool bigitem);
|
int playereat(player_struct* p, int amount, bool bigitem);
|
||||||
void playerdrink(player_struct* p, int amount);
|
void playerdrink(player_struct* p, int amount);
|
||||||
bool playeraddammo(player_struct* p, int weaponindex, int amount);
|
int playeraddammo(player_struct* p, int weaponindex, int amount);
|
||||||
bool playeraddweapon(player_struct* p, int weaponindex, int amount);
|
int playeraddweapon(player_struct* p, int weaponindex, int amount);
|
||||||
void playeraddinventory(player_struct* p, DDukeActor* item, int type, int amount);
|
void playeraddinventory(player_struct* p, DDukeActor* item, int type, int amount);
|
||||||
void actorsizeto(DDukeActor* actor, double x, double y);
|
void actorsizeto(DDukeActor* actor, double x, double y);
|
||||||
void spawndebris(DDukeActor* g_ac, int dnum, int count);
|
void spawndebris(DDukeActor* g_ac, int dnum, int count);
|
||||||
bool checkp(DDukeActor* self, player_struct* p, int flags);
|
int checkp(DDukeActor* self, player_struct* p, int flags);
|
||||||
bool playercheckinventory(player_struct* p, DDukeActor* item, int type, int amount);
|
int playercheckinventory(player_struct* p, DDukeActor* item, int type, int amount);
|
||||||
void playerstomp(player_struct* p, DDukeActor* stomped);
|
void playerstomp(player_struct* p, DDukeActor* stomped);
|
||||||
void playerreset(player_struct* p, DDukeActor* g_ac);
|
void playerreset(player_struct* p, DDukeActor* g_ac);
|
||||||
void wackplayer(player_struct* p);
|
void wackplayer(player_struct* p);
|
||||||
void actoroperate(DDukeActor* g_ac);
|
void actoroperate(DDukeActor* g_ac);
|
||||||
void playerkick(player_struct* p, DDukeActor* g_ac);
|
void playerkick(player_struct* p, DDukeActor* g_ac);
|
||||||
void garybanjo(DDukeActor* g_ac);
|
void garybanjo(DDukeActor* g_ac);
|
||||||
bool ifsquished(DDukeActor* i, int p);
|
int ifsquished(DDukeActor* i, int p);
|
||||||
void fakebubbaspawn(DDukeActor* actor, int g_p);
|
void fakebubbaspawn(DDukeActor* actor, player_struct* p);
|
||||||
void tearitup(sectortype* sect);
|
void tearitup(sectortype* sect);
|
||||||
void destroyit(DDukeActor* actor);
|
void destroyit(DDukeActor* actor);
|
||||||
void mamaspawn(DDukeActor* actor);
|
void mamaspawn(DDukeActor* actor);
|
||||||
|
@ -225,7 +225,7 @@ void displayrooms(int32_t playerNum, double interpfrac, bool sceneonly);
|
||||||
void setgamepalette(int palid);
|
void setgamepalette(int palid);
|
||||||
void resetmys();
|
void resetmys();
|
||||||
void resettimevars();
|
void resettimevars();
|
||||||
bool setnextmap(bool checksecretexit);
|
int setnextmap(bool checksecretexit);
|
||||||
void prelevel_d(int g, TArray<DDukeActor*>&);
|
void prelevel_d(int g, TArray<DDukeActor*>&);
|
||||||
void prelevel_r(int g, TArray<DDukeActor*>&);
|
void prelevel_r(int g, TArray<DDukeActor*>&);
|
||||||
void e4intro(const CompletionFunc& completion);
|
void e4intro(const CompletionFunc& completion);
|
||||||
|
@ -243,6 +243,11 @@ bool checkhitswitch(int snum, walltype* wwal, DDukeActor* act);
|
||||||
void drawshadows(tspriteArray& tsprites, tspritetype* t, DDukeActor* h);
|
void drawshadows(tspriteArray& tsprites, tspritetype* t, DDukeActor* h);
|
||||||
void applyanimations(tspritetype* t, DDukeActor* h, const DVector2& viewVec, DAngle viewang);
|
void applyanimations(tspritetype* t, DDukeActor* h, const DVector2& viewVec, DAngle viewang);
|
||||||
|
|
||||||
|
int LookupAction(DDukeActor* self, FName name);
|
||||||
|
int LookupMove(DDukeActor* self, FName name);
|
||||||
|
int LookupAI(DDukeActor* self, FName name);
|
||||||
|
|
||||||
|
|
||||||
inline int32_t krand(void)
|
inline int32_t krand(void)
|
||||||
{
|
{
|
||||||
randomseed = (randomseed * 27584621) + 1;
|
randomseed = (randomseed * 27584621) + 1;
|
||||||
|
|
|
@ -483,6 +483,26 @@ void GameInterface::FinalizeSetup()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int LookupAction(DDukeActor* self, FName name)
|
||||||
|
{
|
||||||
|
// todo
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LookupMove(DDukeActor* self, FName name)
|
||||||
|
{
|
||||||
|
// todo
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LookupAI(DDukeActor* self, FName name)
|
||||||
|
{
|
||||||
|
// todo
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CallInitialize(DDukeActor* actor)
|
void CallInitialize(DDukeActor* actor)
|
||||||
{
|
{
|
||||||
IFVIRTUALPTR(actor, DDukeActor, Initialize)
|
IFVIRTUALPTR(actor, DDukeActor, Initialize)
|
||||||
|
@ -713,7 +733,7 @@ DEFINE_PROPERTY(movef, Sff, DukeActor)
|
||||||
DEFINE_PROPERTY(action, SZIiiii, DukeActor)
|
DEFINE_PROPERTY(action, SZIiiii, DukeActor)
|
||||||
{
|
{
|
||||||
auto action = &actions[actions.Reserve(1)];
|
auto action = &actions[actions.Reserve(1)];
|
||||||
memset(&action, 0, sizeof(action));
|
memset(action, 0, sizeof(*action));
|
||||||
PROP_STRING_PARM(n, 0);
|
PROP_STRING_PARM(n, 0);
|
||||||
action->name = n;
|
action->name = n;
|
||||||
action->qualifiedName = FStringf("%s.%s", info->TypeName.GetChars(), n);
|
action->qualifiedName = FStringf("%s.%s", info->TypeName.GetChars(), n);
|
||||||
|
@ -761,6 +781,24 @@ DEFINE_PROPERTY(ai, SSSi, DukeActor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_PROPERTY(startaction, S, DukeActor)
|
||||||
|
{
|
||||||
|
PROP_STRING_PARM(n, 0);
|
||||||
|
bag.DefaultAction = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_PROPERTY(startmove, S, DukeActor)
|
||||||
|
{
|
||||||
|
PROP_STRING_PARM(n, 0);
|
||||||
|
bag.DefaultMove = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_PROPERTY(moveflags, I, DukeActor)
|
||||||
|
{
|
||||||
|
PROP_INT_PARM(n, 0);
|
||||||
|
bag.moveflags = n;
|
||||||
|
}
|
||||||
|
|
||||||
CCMD(changewalltexture)
|
CCMD(changewalltexture)
|
||||||
{
|
{
|
||||||
if (argv.argc() < 2) return;
|
if (argv.argc() < 2) return;
|
||||||
|
|
|
@ -1447,7 +1447,7 @@ static int ifcanshoottarget(DDukeActor *actor, int g_p, int g_x)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool ifcansee(DDukeActor* actor, int pnum)
|
int ifcansee(DDukeActor* actor, player_struct* p)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
DDukeActor* tosee;
|
DDukeActor* tosee;
|
||||||
|
@ -1455,19 +1455,19 @@ bool ifcansee(DDukeActor* actor, int pnum)
|
||||||
// select sprite for monster to target
|
// select sprite for monster to target
|
||||||
// if holoduke is on, let them target holoduke first.
|
// if holoduke is on, let them target holoduke first.
|
||||||
//
|
//
|
||||||
if (ps[pnum].holoduke_on != nullptr && !isRR())
|
if (p->holoduke_on != nullptr && !isRR())
|
||||||
{
|
{
|
||||||
tosee = ps[pnum].holoduke_on;
|
tosee = p->holoduke_on;
|
||||||
j = cansee(actor->spr.pos.plusZ(-zrand(32)), actor->sector(), tosee->spr.pos, tosee->sector());
|
j = cansee(actor->spr.pos.plusZ(-zrand(32)), actor->sector(), tosee->spr.pos, tosee->sector());
|
||||||
|
|
||||||
if (j == 0)
|
if (j == 0)
|
||||||
{
|
{
|
||||||
// they can't see player's holoduke
|
// they can't see player's holoduke
|
||||||
// check for player..
|
// check for player..
|
||||||
tosee = ps[pnum].GetActor();
|
tosee = p->GetActor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else tosee = ps[pnum].GetActor(); // holoduke not on. look for player
|
else tosee = p->GetActor(); // holoduke not on. look for player
|
||||||
|
|
||||||
// can they see player, (or player's holoduke)
|
// can they see player, (or player's holoduke)
|
||||||
j = cansee(actor->spr.pos.plusZ(-zrand(48)), actor->sector(), tosee->spr.pos.plusZ(isRR()? -28 : -24), tosee->sector());
|
j = cansee(actor->spr.pos.plusZ(-zrand(48)), actor->sector(), tosee->spr.pos.plusZ(isRR()? -28 : -24), tosee->sector());
|
||||||
|
@ -1533,7 +1533,7 @@ int ParseState::parse(void)
|
||||||
parseifelse(g_ac->actorstayput == nullptr);
|
parseifelse(g_ac->actorstayput == nullptr);
|
||||||
break;
|
break;
|
||||||
case concmd_ifcansee:
|
case concmd_ifcansee:
|
||||||
parseifelse(ifcansee(g_ac, g_p));
|
parseifelse(ifcansee(g_ac, &ps[g_p]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case concmd_ifhitweapon:
|
case concmd_ifhitweapon:
|
||||||
|
@ -1611,7 +1611,7 @@ int ParseState::parse(void)
|
||||||
break;
|
break;
|
||||||
case concmd_fakebubba:
|
case concmd_fakebubba:
|
||||||
insptr++;
|
insptr++;
|
||||||
fakebubbaspawn(g_ac, g_p);
|
fakebubbaspawn(g_ac, &ps[g_p]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case concmd_rndmove:
|
case concmd_rndmove:
|
||||||
|
|
|
@ -1117,6 +1117,7 @@ y(RRTILE5024, 5024)
|
||||||
y(RRTILE5025, 5025)
|
y(RRTILE5025, 5025)
|
||||||
y(RRTILE5026, 5026)
|
y(RRTILE5026, 5026)
|
||||||
y(RRTILE5027, 5027)
|
y(RRTILE5027, 5027)
|
||||||
|
y(BARRELBROKE, 5028)
|
||||||
y(RRTILE5029, 5029)
|
y(RRTILE5029, 5029)
|
||||||
y(RRTILE5030, 5030)
|
y(RRTILE5030, 5030)
|
||||||
y(RRTILE5031, 5031)
|
y(RRTILE5031, 5031)
|
||||||
|
@ -1130,6 +1131,7 @@ y(RRTILE5038, 5038)
|
||||||
y(RRTILE5039, 5039)
|
y(RRTILE5039, 5039)
|
||||||
y(RRTILE5040, 5040)
|
y(RRTILE5040, 5040)
|
||||||
y(RRTILE5041, 5041)
|
y(RRTILE5041, 5041)
|
||||||
|
y(BARREL2BROKE, 5042)
|
||||||
y(RRTILE5043, 5043)
|
y(RRTILE5043, 5043)
|
||||||
y(RRTILE5044, 5044)
|
y(RRTILE5044, 5044)
|
||||||
y(RRTILE5045, 5045)
|
y(RRTILE5045, 5045)
|
||||||
|
@ -1463,7 +1465,8 @@ x(HULKC, 4653)
|
||||||
x(HULKJIBA, 4748)
|
x(HULKJIBA, 4748)
|
||||||
x(HULKJIBB, 4753)
|
x(HULKJIBB, 4753)
|
||||||
x(HULKJIBC, 4758)
|
x(HULKJIBC, 4758)
|
||||||
x(SBSWIPE, 4770)
|
x(BUBBAELVIS, 4770) // RRRA
|
||||||
|
x(SBSWIPE, 4770) // RR
|
||||||
x(SBPAIN, 4810)
|
x(SBPAIN, 4810)
|
||||||
x(SBDIE, 4820)
|
x(SBDIE, 4820)
|
||||||
x(HEN, 4861)
|
x(HEN, 4861)
|
||||||
|
|
|
@ -1050,7 +1050,7 @@ void purplelavacheck(player_struct* p)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool addphealth(player_struct* p, int amount, bool bigitem)
|
void addphealth(player_struct* p, int amount, bool bigitem)
|
||||||
{
|
{
|
||||||
if (p->newOwner != nullptr)
|
if (p->newOwner != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -1072,7 +1072,7 @@ bool addphealth(player_struct* p, int amount, bool bigitem)
|
||||||
{
|
{
|
||||||
if (curhealth > gs.max_player_health && amount > 0)
|
if (curhealth > gs.max_player_health && amount > 0)
|
||||||
{
|
{
|
||||||
return false;
|
return;// false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1103,9 +1103,9 @@ bool addphealth(player_struct* p, int amount, bool bigitem)
|
||||||
p->last_extra = curhealth;
|
p->last_extra = curhealth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
p->GetActor()->spr.extra = curhealth;
|
p->GetActor()->spr.extra = curhealth;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -1114,7 +1114,7 @@ bool addphealth(player_struct* p, int amount, bool bigitem)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool playereat(player_struct* p, int amount, bool bigitem)
|
int playereat(player_struct* p, int amount, bool bigitem)
|
||||||
{
|
{
|
||||||
p->eat += amount;
|
p->eat += amount;
|
||||||
if (p->eat > 100)
|
if (p->eat > 100)
|
||||||
|
@ -1211,7 +1211,7 @@ void playerdrink(player_struct* p, int amount)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool playeraddammo(player_struct* p, int weaponindex, int amount)
|
int playeraddammo(player_struct* p, int weaponindex, int amount)
|
||||||
{
|
{
|
||||||
if (p->ammo_amount[weaponindex] >= gs.max_ammo_amount[weaponindex])
|
if (p->ammo_amount[weaponindex] >= gs.max_ammo_amount[weaponindex])
|
||||||
{
|
{
|
||||||
|
@ -1224,7 +1224,7 @@ bool playeraddammo(player_struct* p, int weaponindex, int amount)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool playeraddweapon(player_struct* p, int weaponindex, int amount)
|
int playeraddweapon(player_struct* p, int weaponindex, int amount)
|
||||||
{
|
{
|
||||||
if (p->gotweapon[weaponindex] == 0) fi.addweapon(p, weaponindex, !!(WeaponSwitch(p- ps) & 1));
|
if (p->gotweapon[weaponindex] == 0) fi.addweapon(p, weaponindex, !!(WeaponSwitch(p- ps) & 1));
|
||||||
else if (p->ammo_amount[weaponindex] >= gs.max_ammo_amount[weaponindex])
|
else if (p->ammo_amount[weaponindex] >= gs.max_ammo_amount[weaponindex])
|
||||||
|
@ -1312,7 +1312,7 @@ void playeraddinventory(player_struct* p, DDukeActor* item, int type, int amount
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool checkp(DDukeActor* self, player_struct* p, int flags)
|
int checkp(DDukeActor* self, player_struct* p, int flags)
|
||||||
{
|
{
|
||||||
bool j = 0;
|
bool j = 0;
|
||||||
|
|
||||||
|
@ -1371,7 +1371,7 @@ bool checkp(DDukeActor* self, player_struct* p, int flags)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool playercheckinventory(player_struct* p, DDukeActor* item, int type, int amount)
|
int playercheckinventory(player_struct* p, DDukeActor* item, int type, int amount)
|
||||||
{
|
{
|
||||||
bool j = 0;
|
bool j = 0;
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -1470,7 +1470,6 @@ void playerreset(player_struct* p, DDukeActor* g_ac)
|
||||||
if (ud.multimode < 2)
|
if (ud.multimode < 2)
|
||||||
{
|
{
|
||||||
gameaction = ga_autoloadgame;
|
gameaction = ga_autoloadgame;
|
||||||
g_ac->killit_flag = 2;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1186,7 +1186,7 @@ void GameInterface::NewGame(MapRecord* map, int skill, bool)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool setnextmap(bool checksecretexit)
|
int setnextmap(bool checksecretexit)
|
||||||
{
|
{
|
||||||
MapRecord* map = nullptr;
|
MapRecord* map = nullptr;
|
||||||
MapRecord* from_bonus = nullptr;
|
MapRecord* from_bonus = nullptr;
|
||||||
|
|
|
@ -228,6 +228,29 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Duke, isshootableswitch, Duke_isshootableswitch)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Duke_checksprite(PClassActor* self)
|
||||||
|
{
|
||||||
|
auto texid = GetDefaultByType(self)->spr.spritetexture();
|
||||||
|
auto tex = TexMan.GetGameTexture(texid);
|
||||||
|
return tex && tex->isValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_Duke, checksprite, Duke_checksprite)
|
||||||
|
{
|
||||||
|
PARAM_PROLOGUE;
|
||||||
|
PARAM_POINTER(v, PClassActor);
|
||||||
|
ACTION_RETURN_BOOL(Duke_checksprite(v));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_Duke, setnextmap, setnextmap)
|
||||||
|
{
|
||||||
|
PARAM_PROLOGUE;
|
||||||
|
PARAM_INT(v);
|
||||||
|
ACTION_RETURN_BOOL(setnextmap(v));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
DEFINE_GLOBAL_UNSIZED(dlevel)
|
DEFINE_GLOBAL_UNSIZED(dlevel)
|
||||||
DEFINE_GLOBAL(camsprite)
|
DEFINE_GLOBAL(camsprite)
|
||||||
|
|
||||||
|
@ -266,6 +289,11 @@ DEFINE_FIELD(DDukeActor, actorstayput)
|
||||||
DEFINE_FIELD(DDukeActor, temp_pos)
|
DEFINE_FIELD(DDukeActor, temp_pos)
|
||||||
DEFINE_FIELD(DDukeActor, temp_pos2)
|
DEFINE_FIELD(DDukeActor, temp_pos2)
|
||||||
DEFINE_FIELD(DDukeActor, temp_angle)
|
DEFINE_FIELD(DDukeActor, temp_angle)
|
||||||
|
DEFINE_FIELD(DDukeActor, curAction)
|
||||||
|
DEFINE_FIELD(DDukeActor, curMove)
|
||||||
|
DEFINE_FIELD(DDukeActor, curAI)
|
||||||
|
DEFINE_FIELD(DDukeActor, actioncounter)
|
||||||
|
DEFINE_FIELD(DDukeActor, killit_flag)
|
||||||
|
|
||||||
void TickActor(DDukeActor*);
|
void TickActor(DDukeActor*);
|
||||||
DEFINE_ACTION_FUNCTION(DDukeActor, Tick)
|
DEFINE_ACTION_FUNCTION(DDukeActor, Tick)
|
||||||
|
@ -385,6 +413,12 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, CheckSoundPlaying, DukeActor_IsSoundPl
|
||||||
ACTION_RETURN_INT(DukeActor_IsSoundPlaying(self, snd, chan));
|
ACTION_RETURN_INT(DukeActor_IsSoundPlaying(self, snd, chan));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, CheckAnyActorSoundPlaying, S_CheckAnyActorSoundPlaying)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
ACTION_RETURN_INT(S_CheckAnyActorSoundPlaying(self));
|
||||||
|
}
|
||||||
|
|
||||||
void DukeActor_StopSound(DDukeActor* self, int snd, int flags)
|
void DukeActor_StopSound(DDukeActor* self, int snd, int flags)
|
||||||
{
|
{
|
||||||
S_StopSound(FSoundID::fromInt(snd), self, flags);
|
S_StopSound(FSoundID::fromInt(snd), self, flags);
|
||||||
|
@ -699,6 +733,14 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, restoreloc, DukeActor_restoreloc)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, fakebubbaspawn, fakebubbaspawn)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
PARAM_POINTER(p, player_struct);
|
||||||
|
fakebubbaspawn(self, p);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, aim, aim_)
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, aim, aim_)
|
||||||
{
|
{
|
||||||
PARAM_SELF_PROLOGUE(DDukeActor);
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
@ -707,6 +749,200 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, aim, aim_)
|
||||||
ACTION_RETURN_POINTER(aim_(self, weapon, aimangle));
|
ACTION_RETURN_POINTER(aim_(self, weapon, aimangle));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Duke_SetAction(DDukeActor* self, int intname)
|
||||||
|
{
|
||||||
|
int ndx = LookupAction(self, FName(ENamedName(intname)));
|
||||||
|
self->curAction = &actions[ndx];
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, SetAction, Duke_SetAction)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
PARAM_INT(n);
|
||||||
|
Duke_SetAction(self, n);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Duke_SetMove(DDukeActor* self, int intname, int flags)
|
||||||
|
{
|
||||||
|
int ndx = LookupMove(self, FName(ENamedName(intname)));
|
||||||
|
self->curMove = &moves[ndx];
|
||||||
|
self->spr.hitag = flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, SetMove, Duke_SetMove)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
PARAM_INT(n);
|
||||||
|
PARAM_INT(f);
|
||||||
|
Duke_SetMove(self, n, f);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Duke_SetAI(DDukeActor* self, int intname)
|
||||||
|
{
|
||||||
|
int ndx = LookupAI(self, FName(ENamedName(intname)));
|
||||||
|
self->curMove = &moves[ais[ndx].move];
|
||||||
|
self->curAction = &actions[ais[ndx].action];
|
||||||
|
self->spr.hitag = ais[ndx].moveflags;
|
||||||
|
self->curAI = ais[ndx].name;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, SetAI, Duke_SetAI)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
PARAM_INT(n);
|
||||||
|
Duke_SetAI(self, n);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, checkp, checkp)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
PARAM_POINTER(p, player_struct);
|
||||||
|
PARAM_INT(n);
|
||||||
|
ACTION_RETURN_INT(checkp(self, p, n));
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, cansee, ifcansee)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
PARAM_POINTER(p, player_struct);
|
||||||
|
PARAM_INT(n);
|
||||||
|
ACTION_RETURN_INT(ifcansee(self, p));
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, actoroperate, actoroperate)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
actoroperate(self);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, ifsquished, ifsquished)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
PARAM_POINTER(p, player_struct);
|
||||||
|
ACTION_RETURN_INT(ifcansee(self, p));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Duke_ChangeType(DDukeActor* self, PClassActor* type)
|
||||||
|
{
|
||||||
|
self->ChangeType(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, ChangeType, Duke_ChangeType)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
PARAM_POINTER(type, PClassActor);
|
||||||
|
self->ChangeType(type);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Duke_fall(DDukeActor* self, player_struct* p)
|
||||||
|
{
|
||||||
|
fi.fall(self, p->GetPlayerNum());
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, fall, Duke_fall)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
PARAM_POINTER(p, player_struct);
|
||||||
|
Duke_fall(self, p);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, actorsizeto, actorsizeto)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
PARAM_FLOAT(x);
|
||||||
|
PARAM_FLOAT(y);
|
||||||
|
actorsizeto(self, x, y);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, dodge, dodge)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
ACTION_RETURN_INT(dodge(self));
|
||||||
|
}
|
||||||
|
|
||||||
|
int Duke_ifcanshoottarget(DDukeActor* self, player_struct* p, double dist)
|
||||||
|
{
|
||||||
|
return ifcanshoottarget(self, p->GetPlayerNum(), int(dist * worldtoint));
|
||||||
|
}
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, ifcanshoottarget, Duke_ifcanshoottarget)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
PARAM_POINTER(p, player_struct);
|
||||||
|
PARAM_FLOAT(x);
|
||||||
|
ACTION_RETURN_INT(Duke_ifcanshoottarget(self, p, x));
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, spriteglass, spriteglass)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
PARAM_INT(x);
|
||||||
|
spriteglass(self, x);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, spawndebris, spawndebris)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
PARAM_INT(x);
|
||||||
|
PARAM_INT(y);
|
||||||
|
spawndebris(self, x, y);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, respawnhitag, respawnhitag)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
respawnhitag(self);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, destroyit, destroyit)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
destroyit(self);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, mamaspawn, mamaspawn)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
mamaspawn(self);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, garybanjo, garybanjo)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
garybanjo(self);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int duke_GetambientSound(DDukeActor* actor)
|
||||||
|
{
|
||||||
|
return ambienttags.SafeGet(actor->spr.detail, {}).lo;
|
||||||
|
}
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, GetAmbientSound, duke_GetambientSound)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
ACTION_RETURN_INT(duke_GetambientSound(self));
|
||||||
|
}
|
||||||
|
|
||||||
|
double duke_GetambientDist(DDukeActor* actor)
|
||||||
|
{
|
||||||
|
return ambienttags.SafeGet(actor->spr.detail, {}).hi * maptoworld;
|
||||||
|
}
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, GetAmbientDist, duke_GetambientDist)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(DDukeActor);
|
||||||
|
ACTION_RETURN_FLOAT(duke_GetambientDist(self));
|
||||||
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, addkill, addkill)
|
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, addkill, addkill)
|
||||||
{
|
{
|
||||||
|
@ -751,9 +987,7 @@ DEFINE_FIELD_X(DukePlayer, player_struct, invdisptime)
|
||||||
//DEFINE_FIELD_X(DukePlayer, player_struct, bobposy)
|
//DEFINE_FIELD_X(DukePlayer, player_struct, bobposy)
|
||||||
DEFINE_FIELD_X(DukePlayer, player_struct, pyoff)
|
DEFINE_FIELD_X(DukePlayer, player_struct, pyoff)
|
||||||
DEFINE_FIELD_X(DukePlayer, player_struct, opyoff)
|
DEFINE_FIELD_X(DukePlayer, player_struct, opyoff)
|
||||||
//DEFINE_FIELD_X(DukePlayer, player_struct, posxv)
|
DEFINE_FIELD_X(DukePlayer, player_struct, vel)
|
||||||
//DEFINE_FIELD_X(DukePlayer, player_struct, posyv)
|
|
||||||
//DEFINE_FIELD_X(DukePlayer, player_struct, poszv)
|
|
||||||
DEFINE_FIELD_X(DukePlayer, player_struct, last_pissed_time)
|
DEFINE_FIELD_X(DukePlayer, player_struct, last_pissed_time)
|
||||||
DEFINE_FIELD_X(DukePlayer, player_struct, truefz)
|
DEFINE_FIELD_X(DukePlayer, player_struct, truefz)
|
||||||
DEFINE_FIELD_X(DukePlayer, player_struct, truecz)
|
DEFINE_FIELD_X(DukePlayer, player_struct, truecz)
|
||||||
|
@ -1131,6 +1365,127 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, checkhitswitch, pl_checkhitswitch)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playerkick, playerkick)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||||
|
PARAM_POINTER(act, DDukeActor);
|
||||||
|
playerkick(self, act);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playerstomp, playerstomp)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||||
|
PARAM_POINTER(act, DDukeActor);
|
||||||
|
playerstomp(self, act);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playerreset, playerreset)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||||
|
PARAM_POINTER(act, DDukeActor);
|
||||||
|
playerreset(self, act);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, addphealth, addphealth)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||||
|
PARAM_INT(amt);
|
||||||
|
PARAM_INT(big);
|
||||||
|
addphealth(self, amt, big);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, wackplayer, wackplayer)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||||
|
wackplayer(self);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void duke_checkweapons(player_struct* p)
|
||||||
|
{
|
||||||
|
fi.checkweapons(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, checkweapons, duke_checkweapons)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||||
|
duke_checkweapons(self);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void msg(player_struct* p, int num)
|
||||||
|
{
|
||||||
|
FTA(num, p);
|
||||||
|
}
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, FTA, msg)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||||
|
PARAM_INT(num);
|
||||||
|
FTA(num, self);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playercheckinventory, playercheckinventory)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||||
|
PARAM_POINTER(act, DDukeActor);
|
||||||
|
PARAM_INT(num);
|
||||||
|
PARAM_INT(amt);
|
||||||
|
ACTION_RETURN_BOOL(playercheckinventory(self, act, num, amt));
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playeraddinventory, playeraddinventory)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||||
|
PARAM_POINTER(act, DDukeActor);
|
||||||
|
PARAM_INT(num);
|
||||||
|
PARAM_INT(amt);
|
||||||
|
playeraddinventory(self, act, num, amt);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playeraddweapon, playeraddweapon)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||||
|
PARAM_INT(num);
|
||||||
|
PARAM_INT(amt);
|
||||||
|
ACTION_RETURN_BOOL(playeraddweapon(self, num, amt));
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playeraddammo, playeraddammo)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||||
|
PARAM_INT(num);
|
||||||
|
PARAM_INT(amt);
|
||||||
|
ACTION_RETURN_BOOL(playeraddammo(self, num, amt));
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, forceplayerangle, forceplayerangle)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||||
|
forceplayerangle(self);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playereat, playereat)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||||
|
PARAM_INT(amt);
|
||||||
|
PARAM_BOOL(big);
|
||||||
|
ACTION_RETURN_BOOL(playereat(self, amt, big));
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, playerdrink, playerdrink)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(player_struct);
|
||||||
|
PARAM_INT(amt);
|
||||||
|
playerdrink(self, amt);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static DDukeActor* duke_firstStat(DukeStatIterator* it, int statnum)
|
static DDukeActor* duke_firstStat(DukeStatIterator* it, int statnum)
|
||||||
{
|
{
|
||||||
|
@ -1395,6 +1750,15 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, setanimation, static_cast<int(*)(secto
|
||||||
ACTION_RETURN_INT(setanimation(asect, tag, sect, dest, vel));
|
ACTION_RETURN_INT(setanimation(asect, tag, sect, dest, vel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(_DukeLevel, tearitup, tearitup)
|
||||||
|
{
|
||||||
|
PARAM_PROLOGUE;
|
||||||
|
PARAM_POINTER(sect, sectortype);
|
||||||
|
tearitup(sect);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DEFINE_FIELD_X(DukeGameInfo, DukeGameInfo, max_ammo_amount);
|
DEFINE_FIELD_X(DukeGameInfo, DukeGameInfo, max_ammo_amount);
|
||||||
DEFINE_FIELD_X(DukeGameInfo, DukeGameInfo, playerfriction);
|
DEFINE_FIELD_X(DukeGameInfo, DukeGameInfo, playerfriction);
|
||||||
DEFINE_FIELD_X(DukeGameInfo, DukeGameInfo, gravity);
|
DEFINE_FIELD_X(DukeGameInfo, DukeGameInfo, gravity);
|
||||||
|
@ -1455,6 +1819,20 @@ DEFINE_FIELD_X(DukeUserDefs, user_defs, ufospawnsminion);
|
||||||
DEFINE_FIELD_X(DukeUserDefs, user_defs, joe9000);
|
DEFINE_FIELD_X(DukeUserDefs, user_defs, joe9000);
|
||||||
DEFINE_GLOBAL_UNSIZED(ud)
|
DEFINE_GLOBAL_UNSIZED(ud)
|
||||||
|
|
||||||
|
DEFINE_FIELD_X(ActorMove, ActorMove, qualifiedName);
|
||||||
|
DEFINE_FIELD_X(ActorMove, ActorMove, name);
|
||||||
|
DEFINE_FIELD_X(ActorMove, ActorMove, movex);
|
||||||
|
DEFINE_FIELD_X(ActorMove, ActorMove, movez);
|
||||||
|
|
||||||
|
DEFINE_FIELD_X(ActorAction, ActorAction, qualifiedName);
|
||||||
|
DEFINE_FIELD_X(ActorAction, ActorAction, name);
|
||||||
|
DEFINE_FIELD_X(ActorAction, ActorAction, base);
|
||||||
|
DEFINE_FIELD_X(ActorAction, ActorAction, offset);
|
||||||
|
DEFINE_FIELD_X(ActorAction, ActorAction, numframes);
|
||||||
|
DEFINE_FIELD_X(ActorAction, ActorAction, rotationtype);
|
||||||
|
DEFINE_FIELD_X(ActorAction, ActorAction, increment);
|
||||||
|
DEFINE_FIELD_X(ActorAction, ActorAction, delay);
|
||||||
|
|
||||||
|
|
||||||
// this is only a temporary helper until weaponsandammosprites can be migrated to real class types. We absolutely do not want any access to tile numbers in the scripts - even now.
|
// this is only a temporary helper until weaponsandammosprites can be migrated to real class types. We absolutely do not want any access to tile numbers in the scripts - even now.
|
||||||
void tspritetype_setWeaponOrAmmoSprite(tspritetype* targ, unsigned z)
|
void tspritetype_setWeaponOrAmmoSprite(tspritetype* targ, unsigned z)
|
||||||
|
|
|
@ -83,6 +83,31 @@ enum ESectorTriggers
|
||||||
// left: ST 32767, 65534, 65535
|
// left: ST 32767, 65534, 65535
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum dukeinv_t
|
||||||
|
{
|
||||||
|
GET_STEROIDS, // 0
|
||||||
|
GET_SHIELD,
|
||||||
|
GET_SCUBA,
|
||||||
|
GET_HOLODUKE,
|
||||||
|
GET_JETPACK,
|
||||||
|
GET_DUMMY1, // 5
|
||||||
|
GET_ACCESS,
|
||||||
|
GET_HEATS,
|
||||||
|
GET_DUMMY2,
|
||||||
|
GET_FIRSTAID,
|
||||||
|
GET_BOOTS, // 10
|
||||||
|
GET_MAX,
|
||||||
|
|
||||||
|
GET_MOONSHINE = 0,
|
||||||
|
GET_KELVAR = 1,
|
||||||
|
GET_BEER = 3,
|
||||||
|
GET_COWPIE = 4,
|
||||||
|
GET_KEYS = 6,
|
||||||
|
GET_WHISKEY = 9,
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
class DukeActor : CoreActor native
|
class DukeActor : CoreActor native
|
||||||
{
|
{
|
||||||
default
|
default
|
||||||
|
@ -126,12 +151,16 @@ class DukeActor : CoreActor native
|
||||||
enum amoveflags_t
|
enum amoveflags_t
|
||||||
{
|
{
|
||||||
face_player = 1,
|
face_player = 1,
|
||||||
|
faceplayer = 1,
|
||||||
geth = 2,
|
geth = 2,
|
||||||
getv = 4,
|
getv = 4,
|
||||||
random_angle = 8,
|
random_angle = 8,
|
||||||
|
randomangle = 8,
|
||||||
face_player_slow = 16,
|
face_player_slow = 16,
|
||||||
|
faceplayerslow = 16,
|
||||||
spin = 32,
|
spin = 32,
|
||||||
face_player_smart = 64,
|
face_player_smart = 64,
|
||||||
|
faceplayersmart = 64,
|
||||||
fleeenemy = 128,
|
fleeenemy = 128,
|
||||||
jumptoplayer_only = 256,
|
jumptoplayer_only = 256,
|
||||||
justjump1 = 256,
|
justjump1 = 256,
|
||||||
|
@ -144,6 +173,66 @@ class DukeActor : CoreActor native
|
||||||
antifaceplayerslow = 32768
|
antifaceplayerslow = 32768
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum pstateflags
|
||||||
|
{
|
||||||
|
pstanding = 1,
|
||||||
|
pwalking = 2,
|
||||||
|
prunning = 4,
|
||||||
|
pducking = 8,
|
||||||
|
pfalling = 16,
|
||||||
|
pjumping = 32,
|
||||||
|
phigher = 64,
|
||||||
|
pwalkingback = 128,
|
||||||
|
prunningback = 256,
|
||||||
|
pkicking = 512,
|
||||||
|
pshrunk = 1024,
|
||||||
|
pjetpack = 2048,
|
||||||
|
ponsteroids = 4096,
|
||||||
|
ponground = 8192,
|
||||||
|
palive = 16384,
|
||||||
|
pdead = 32768,
|
||||||
|
pfacing = 65536
|
||||||
|
}
|
||||||
|
|
||||||
|
const ONFIRETIME = 164;
|
||||||
|
const FIREPAINFREQ = 16;
|
||||||
|
const SHRUNKDONECOUNT = 304;
|
||||||
|
const SPAWNAMMOODDS = 96;
|
||||||
|
const SWEARFREQUENCY = 100;
|
||||||
|
const MAXSLEEPDISTF = 1024;
|
||||||
|
const SHRUNKCOUNT = 270;
|
||||||
|
const SLEEPTIME = 1536;
|
||||||
|
const THAWTIME = 138;
|
||||||
|
const FROZENQUICKKICKDIST = 980;
|
||||||
|
const FROZENDRIPTIME = 90;
|
||||||
|
const PLAYDEADTIME = 120;
|
||||||
|
const RESPAWNACTORTIME = 768;
|
||||||
|
const MAXXSTRETCH = 70;
|
||||||
|
const MAXYSTRETCH = 70;
|
||||||
|
const MINXSTRETCH = 9;
|
||||||
|
const MINYSTRETCH = 8;
|
||||||
|
const SQUISHABLEDISTANCE = 1024;
|
||||||
|
const RETRIEVEDISTANCE = 844;
|
||||||
|
const RESPAWNITEMTIME = 768;
|
||||||
|
|
||||||
|
const WEAKEST = 1;
|
||||||
|
const WEAK = 5;
|
||||||
|
const MEDIUMSTRENGTH = 10;
|
||||||
|
const TOUGH = 20;
|
||||||
|
const REALLYTOUGH = 30;
|
||||||
|
const MAXPLAYERHEALTH = 100;
|
||||||
|
const MEGASTRENGTH = 10000;
|
||||||
|
|
||||||
|
|
||||||
|
const STEROID_AMOUNT = 400;
|
||||||
|
const SHIELD_AMOUNT = 100;
|
||||||
|
const SCUBA_AMOUNT = 6400;
|
||||||
|
const HOLODUKE_AMOUNT = 2400;
|
||||||
|
const JETPACK_AMOUNT = 1600;
|
||||||
|
const HEAT_AMOUNT = 1200;
|
||||||
|
const FIRSTAID_AMOUNT = MAXPLAYERHEALTH;
|
||||||
|
const BOOT_AMOUNT = 200;
|
||||||
|
|
||||||
meta int gutsoffset;
|
meta int gutsoffset;
|
||||||
meta int falladjustz;
|
meta int falladjustz;
|
||||||
meta int aimoffset;
|
meta int aimoffset;
|
||||||
|
@ -187,6 +276,12 @@ class DukeActor : CoreActor native
|
||||||
native Vector3 temp_pos, temp_pos2;
|
native Vector3 temp_pos, temp_pos2;
|
||||||
native double temp_angle;
|
native double temp_angle;
|
||||||
|
|
||||||
|
native ActorAction curAction;
|
||||||
|
native ActorMove curMove;
|
||||||
|
native Name curAI;
|
||||||
|
native int16 actioncounter;
|
||||||
|
native uint8 killit_flag;
|
||||||
|
|
||||||
// flags are implemented natively to avoid the prefixes.
|
// flags are implemented natively to avoid the prefixes.
|
||||||
|
|
||||||
native void getglobalz();
|
native void getglobalz();
|
||||||
|
@ -196,6 +291,7 @@ class DukeActor : CoreActor native
|
||||||
native int domove(int clipmask);
|
native int domove(int clipmask);
|
||||||
native int PlayActorSound(Sound snd, int chan = CHAN_AUTO, int flags = 0);
|
native int PlayActorSound(Sound snd, int chan = CHAN_AUTO, int flags = 0);
|
||||||
native int CheckSoundPlaying(Sound snd, int chan = CHAN_AUTO);
|
native int CheckSoundPlaying(Sound snd, int chan = CHAN_AUTO);
|
||||||
|
native bool CheckAnyActorSoundPlaying();
|
||||||
native void StopSound(Sound snd, int flags = 0);
|
native void StopSound(Sound snd, int flags = 0);
|
||||||
native DukeActor spawn(class<DukeActor> type);
|
native DukeActor spawn(class<DukeActor> type);
|
||||||
native DukeActor spawnsprite(int type); // for cases where the map has a picnum stored. Avoid when possible.
|
native DukeActor spawnsprite(int type); // for cases where the map has a picnum stored. Avoid when possible.
|
||||||
|
@ -210,6 +306,24 @@ class DukeActor : CoreActor native
|
||||||
native int SpriteHeight();
|
native int SpriteHeight();
|
||||||
native DukeActor aim(readonly<DukeActor> weapon, double aimangle = -1);
|
native DukeActor aim(readonly<DukeActor> weapon, double aimangle = -1);
|
||||||
|
|
||||||
|
// CON simulation
|
||||||
|
native void SetAction(Name act);
|
||||||
|
native void SetAI(Name ai);
|
||||||
|
native void SetMove(Name mov, int flags = 0);
|
||||||
|
native bool checkp(DukePlayer p, int flags);
|
||||||
|
native bool cansee(DukePlayer p);
|
||||||
|
native void actoroperate();
|
||||||
|
native bool ifsquished(DukePlayer p);
|
||||||
|
native void ChangeType(class<DukeActor> newtype);
|
||||||
|
native void fall(DukePlayer p);
|
||||||
|
native void actorsizeto(double x, double y);
|
||||||
|
native bool dodge();
|
||||||
|
native bool ifcanshoottarget(DukePlayer p, double pdist);
|
||||||
|
native void spriteglass(int n);
|
||||||
|
native void spawndebris(int dnum, int count);
|
||||||
|
native void respawnhitag();
|
||||||
|
|
||||||
|
|
||||||
virtual native void Tick();
|
virtual native void Tick();
|
||||||
|
|
||||||
|
|
||||||
|
@ -222,7 +336,7 @@ class DukeActor : CoreActor native
|
||||||
virtual void onMotoSmash(DukePlayer toucher) {}
|
virtual void onMotoSmash(DukePlayer toucher) {}
|
||||||
virtual void onRespawn(int tag) { }
|
virtual void onRespawn(int tag) { }
|
||||||
virtual bool animate(tspritetype tspr) { return false; }
|
virtual bool animate(tspritetype tspr) { return false; }
|
||||||
virtual void RunState() {} // this is the CON function.
|
virtual void RunState(DukePlayer p, double pdist) {} // this is the CON function.
|
||||||
virtual void PlayFTASound() {}
|
virtual void PlayFTASound() {}
|
||||||
virtual void StandingOn(DukePlayer p) {}
|
virtual void StandingOn(DukePlayer p) {}
|
||||||
virtual bool TriggerSwitch(DukePlayer activator) { return false; }
|
virtual bool TriggerSwitch(DukePlayer activator) { return false; }
|
||||||
|
@ -249,6 +363,12 @@ class DukeActor : CoreActor native
|
||||||
native void insertspriteq();
|
native void insertspriteq();
|
||||||
native void operateforcefields(int tag);
|
native void operateforcefields(int tag);
|
||||||
native void restoreloc();
|
native void restoreloc();
|
||||||
|
native void fakebubbaspawn(DukePlayer p);
|
||||||
|
native void destroyit();
|
||||||
|
native void mamaspawn();
|
||||||
|
native void garybanjo();
|
||||||
|
native Sound GetAmbientSound();
|
||||||
|
native double GetAmbientDist();
|
||||||
native void addkill();
|
native void addkill();
|
||||||
native void subkill();
|
native void subkill();
|
||||||
|
|
||||||
|
@ -379,6 +499,7 @@ struct DukeLevel
|
||||||
native static DukeActor LocateTheLocator(int n, sectortype sect);
|
native static DukeActor LocateTheLocator(int n, sectortype sect);
|
||||||
native static int getanimationindex(int type, sectortype sec);
|
native static int getanimationindex(int type, sectortype sec);
|
||||||
native static int setanimation(sectortype animsect, int type, sectortype sec, double target, double vel);
|
native static int setanimation(sectortype animsect, int type, sectortype sec, double target, double vel);
|
||||||
|
native static void tearitup(sectortype sect);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DukeStatIterator
|
struct DukeStatIterator
|
||||||
|
|
|
@ -180,6 +180,8 @@ struct Duke native
|
||||||
static native void setlastvisinc(int amount);
|
static native void setlastvisinc(int amount);
|
||||||
static native bool isaccessswitch(TextureID tex);
|
static native bool isaccessswitch(TextureID tex);
|
||||||
static native bool isshootableswitch(TextureID tex);
|
static native bool isshootableswitch(TextureID tex);
|
||||||
|
static native bool CheckSprite(class<DukeActor> tex);
|
||||||
|
static native bool setnextmap(bool checksecret);
|
||||||
static int rnd(int val)
|
static int rnd(int val)
|
||||||
{
|
{
|
||||||
return (random(0, 255) >= (255 - (val)));
|
return (random(0, 255) >= (255 - (val)));
|
||||||
|
@ -239,6 +241,7 @@ struct DukePlayer native
|
||||||
uint16_t frags[MAXPLAYERS];
|
uint16_t frags[MAXPLAYERS];
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
native vector3 vel;
|
||||||
native bool gotweapon[DukeWpn.MAX_WEAPONS];
|
native bool gotweapon[DukeWpn.MAX_WEAPONS];
|
||||||
|
|
||||||
// Palette management uses indices into the engine's palette table now.
|
// Palette management uses indices into the engine's palette table now.
|
||||||
|
@ -387,7 +390,20 @@ struct DukePlayer native
|
||||||
native void StartBoat();
|
native void StartBoat();
|
||||||
native void checkhitswitch(walltype wal, DukeActor act);
|
native void checkhitswitch(walltype wal, DukeActor act);
|
||||||
|
|
||||||
|
native void playerkick(DukeActor target);
|
||||||
|
native void playerstomp(DukeActor target);
|
||||||
|
native void addphealth(int amount, bool bigitem = false);
|
||||||
|
native void wackplayer();
|
||||||
|
native void checkweapons();
|
||||||
|
native void playerreset(DukeActor ac);
|
||||||
|
native void FTA(int num);
|
||||||
|
native bool playercheckinventory(DukeActor item, int type, int amount);
|
||||||
|
native void playeraddinventory(DukeActor item, int type, int amount);
|
||||||
|
native bool playeraddweapon(int type, int amount);
|
||||||
|
native bool playeraddammo(int type, int amount);
|
||||||
|
native void forceplayerangle();
|
||||||
|
native bool playereat(int amount, bool bigitem);
|
||||||
|
native void playerdrink(int amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DukeWpn
|
struct DukeWpn
|
||||||
|
@ -480,7 +496,7 @@ struct DukeGameInfo native
|
||||||
|
|
||||||
struct DukeUserDefs native
|
struct DukeUserDefs native
|
||||||
{
|
{
|
||||||
native readonly uint8 god, cashman, eog;
|
native uint8 god, cashman, eog;
|
||||||
native readonly uint8 clipping;
|
native readonly uint8 clipping;
|
||||||
native readonly uint8 user_pals[MAXPLAYERS];
|
native readonly uint8 user_pals[MAXPLAYERS];
|
||||||
native readonly int16 from_bonus;
|
native readonly int16 from_bonus;
|
||||||
|
@ -497,3 +513,22 @@ struct DukeUserDefs native
|
||||||
native DukeActor cameraactor;
|
native DukeActor cameraactor;
|
||||||
native bool joe9000;
|
native bool joe9000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct ActorMove native
|
||||||
|
{
|
||||||
|
native Name qualifiedName; // this is only used for serialization.
|
||||||
|
native Name name;
|
||||||
|
native float movex, movez;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ActorAction native
|
||||||
|
{
|
||||||
|
native Name qualifiedName; // this is only used for serialization.
|
||||||
|
native Name name;
|
||||||
|
native TextureID base;
|
||||||
|
native int offset;
|
||||||
|
native int16 numframes;
|
||||||
|
native int16 rotationtype;
|
||||||
|
native int16 increment;
|
||||||
|
native int16 delay;
|
||||||
|
};
|
||||||
|
|
|
@ -148,6 +148,9 @@ struct sectortype native
|
||||||
native readonly int16 ceilingheinum;
|
native readonly int16 ceilingheinum;
|
||||||
native readonly int16 floorheinum;
|
native readonly int16 floorheinum;
|
||||||
|
|
||||||
|
native readonly TextureID ceilingtexture;
|
||||||
|
native readonly TextureID floortexture;
|
||||||
|
|
||||||
native Array<@walltype> walls;
|
native Array<@walltype> walls;
|
||||||
native int16 ceilingstat;
|
native int16 ceilingstat;
|
||||||
native int16 floorstat;
|
native int16 floorstat;
|
||||||
|
|
|
@ -215,13 +215,14 @@ struct Raze
|
||||||
native static Sound FindSoundByResID(int id);
|
native static Sound FindSoundByResID(int id);
|
||||||
|
|
||||||
native static int tileflags(TextureID tex);
|
native static int tileflags(TextureID tex);
|
||||||
|
native static int tilesurface(TextureID tex);
|
||||||
|
|
||||||
native static sectortype updatesector(Vector2 pos, sectortype lastsect, double maxdist = 96);
|
native static sectortype updatesector(Vector2 pos, sectortype lastsect, double maxdist = 96);
|
||||||
native static sectortype, Vector3 clipmove(Vector3 pos, sectortype sect, Vector2 move, double walldist, double ceildist, double flordist, uint cliptype, CollisionData coll, int clipmoveboxtracenum = 3);
|
native static sectortype, Vector3 clipmove(Vector3 pos, sectortype sect, Vector2 move, double walldist, double ceildist, double flordist, uint cliptype, CollisionData coll, int clipmoveboxtracenum = 3);
|
||||||
native static bool cansee(Vector3 start, sectortype startsec, Vector3 end, sectortype endsec);
|
native static bool cansee(Vector3 start, sectortype startsec, Vector3 end, sectortype endsec);
|
||||||
native static int hitscan(Vector3 start, sectortype startsect, Vector3 vect, HitInfo hitinfo, uint cliptype, double maxrange = -1);
|
native static int hitscan(Vector3 start, sectortype startsect, Vector3 vect, HitInfo hitinfo, uint cliptype, double maxrange = -1);
|
||||||
|
|
||||||
// game check shortcuts
|
// game check shortcuts (todo: meake these compile time constant intrinsics)
|
||||||
|
|
||||||
static bool isDuke()
|
static bool isDuke()
|
||||||
{
|
{
|
||||||
|
@ -248,6 +249,11 @@ struct Raze
|
||||||
return gameinfo.gametype & (GAMEFLAG_RRALL);
|
return gameinfo.gametype & (GAMEFLAG_RRALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isRoute66()
|
||||||
|
{
|
||||||
|
return gameinfo.gametype & (GAMEFLAG_ROUTE66);
|
||||||
|
}
|
||||||
|
|
||||||
static bool isRRRA()
|
static bool isRRRA()
|
||||||
{
|
{
|
||||||
return gameinfo.gametype & (GAMEFLAG_RRRA);
|
return gameinfo.gametype & (GAMEFLAG_RRRA);
|
||||||
|
@ -263,6 +269,11 @@ struct Raze
|
||||||
return gameinfo.gametype & GAMEFLAG_PLUTOPAK;
|
return gameinfo.gametype & GAMEFLAG_PLUTOPAK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isVacation()
|
||||||
|
{
|
||||||
|
return gameinfo.gametype & GAMEFLAG_DUKEVACA;
|
||||||
|
}
|
||||||
|
|
||||||
static bool isShareware()
|
static bool isShareware()
|
||||||
{
|
{
|
||||||
return gameinfo.gametype & GAMEFLAG_SHAREWARE;
|
return gameinfo.gametype & GAMEFLAG_SHAREWARE;
|
||||||
|
|
Loading…
Reference in a new issue