- fixed: The BFG needs to get its default ammo usage from the DehInfo struct.

- fixed: State's fields need to be declared native.
This commit is contained in:
Christoph Oelckers 2016-11-25 01:33:04 +01:00
parent c25774e311
commit 11ac0c622b
4 changed files with 38 additions and 16 deletions

View file

@ -214,6 +214,12 @@ DehInfo deh =
40, // BFG cells per shot 40, // BFG cells per shot
}; };
DEFINE_FIELD_X(DehInfo, DehInfo, MaxSoulsphere)
DEFINE_FIELD_X(DehInfo, DehInfo, ExplosionStyle)
DEFINE_FIELD_X(DehInfo, DehInfo, ExplosionAlpha)
DEFINE_FIELD_X(DehInfo, DehInfo, NoAutofreeze)
DEFINE_FIELD_X(DehInfo, DehInfo, BFGCells)
// Doom identified pickup items by their sprites. ZDoom prefers to use their // Doom identified pickup items by their sprites. ZDoom prefers to use their
// class type to identify them instead. To support the traditional Doom // class type to identify them instead. To support the traditional Doom
// behavior, for every thing touched by dehacked that has the MF_PICKUP flag, // behavior, for every thing touched by dehacked that has the MF_PICKUP flag,

View file

@ -706,6 +706,11 @@ void InitThingdef()
PField *levelf = new PField("level", lstruct, VARF_Native | VARF_Static, (intptr_t)&level); PField *levelf = new PField("level", lstruct, VARF_Native | VARF_Static, (intptr_t)&level);
GlobalSymbols.AddSymbol(levelf); GlobalSymbols.AddSymbol(levelf);
// set up a variable for the DEH data
PStruct *dstruct = NewNativeStruct("DehInfo", nullptr);
PField *dehi = new PField("deh", dstruct, VARF_Native | VARF_Static, (intptr_t)&deh);
GlobalSymbols.AddSymbol(dehi);
// set up a variable for the global players array. // set up a variable for the global players array.
PStruct *pstruct = NewNativeStruct("PlayerInfo", nullptr); PStruct *pstruct = NewNativeStruct("PlayerInfo", nullptr);
pstruct->Size = sizeof(player_t); pstruct->Size = sizeof(player_t);

View file

@ -92,23 +92,34 @@ struct LevelLocals native
// level_info_t *info cannot be done yet. // level_info_t *info cannot be done yet.
} }
// a few values of this need to be readable by the play code.
// Most are handled at load time and are omitted here.
struct DehInfo native
{
native int MaxSoulsphere;
native uint8 ExplosionStyle;
native double ExplosionAlpha;
native int NoAutofreeze;
native int BFGCells;
}
struct State native struct State native
{ {
State NextState; native State NextState;
int sprite; native int sprite;
int16 Tics; native int16 Tics;
uint16 TicRange; native uint16 TicRange;
uint8 Frame; native uint8 Frame;
uint8 UseFlags; native uint8 UseFlags;
int Misc1; native int Misc1;
int Misc2; native int Misc2;
uint16 bSlow; native uint16 bSlow;
uint16 bFast; native uint16 bFast;
bool bFullbright; native bool bFullbright;
bool bNoDelay; native bool bNoDelay;
bool bSameFrame; native bool bSameFrame;
bool bCanRaise; native bool bCanRaise;
bool bDehacked; native bool bDehacked;
} }
struct Sector native struct Sector native

View file

@ -77,7 +77,7 @@ extend class StateProvider
Weapon weap = player.ReadyWeapon; Weapon weap = player.ReadyWeapon;
if (weap != null && invoker == weap && stateinfo != null && stateinfo.mStateType == STATE_Psprite) if (weap != null && invoker == weap && stateinfo != null && stateinfo.mStateType == STATE_Psprite)
{ {
if (!weap.DepleteAmmo (weap.bAltFire, true, 1)) if (!weap.DepleteAmmo (weap.bAltFire, true, deh.MaxSoulsphere/*BFGCells*/))
return; return;
} }