- completed Heretic scriptification with the two remaining artifacts.

This commit is contained in:
Christoph Oelckers 2016-11-25 18:41:00 +01:00
parent 4f370ba181
commit 0d6f37835f
11 changed files with 77 additions and 104 deletions

View file

@ -824,7 +824,6 @@ endif()
file( GLOB HEADER_FILES file( GLOB HEADER_FILES
${EXTRA_HEADER_DIRS} ${EXTRA_HEADER_DIRS}
fragglescript/*.h fragglescript/*.h
g_heretic/*.h
g_hexen/*.h g_hexen/*.h
g_raven/*.h g_raven/*.h
g_shared/*.h g_shared/*.h
@ -857,7 +856,6 @@ set( NOT_COMPILED_SOURCE_FILES
${OTHER_SYSTEM_SOURCES} ${OTHER_SYSTEM_SOURCES}
sc_man_scanner.h sc_man_scanner.h
sc_man_scanner.re sc_man_scanner.re
g_heretic/a_hereticartifacts.cpp
g_hexen/a_blastradius.cpp g_hexen/a_blastradius.cpp
g_hexen/a_boostarmor.cpp g_hexen/a_boostarmor.cpp
g_hexen/a_clericflame.cpp g_hexen/a_clericflame.cpp
@ -1148,7 +1146,6 @@ set (PCH_SOURCES
w_wad.cpp w_wad.cpp
wi_stuff.cpp wi_stuff.cpp
zstrformat.cpp zstrformat.cpp
g_heretic/a_hereticmisc.cpp
g_hexen/a_hexenmisc.cpp g_hexen/a_hexenmisc.cpp
g_raven/a_artitele.cpp g_raven/a_artitele.cpp
g_raven/a_minotaur.cpp g_raven/a_minotaur.cpp
@ -1303,7 +1300,6 @@ endif()
target_link_libraries( zdoom ${ZDOOM_LIBS} gdtoa dumb lzma ) target_link_libraries( zdoom ${ZDOOM_LIBS} gdtoa dumb lzma )
include_directories( . include_directories( .
g_heretic
g_hexen g_hexen
g_raven g_raven
g_strife g_strife
@ -1436,7 +1432,6 @@ source_group("External\\Math" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/m
source_group("External\\RapidJSON" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/.+") source_group("External\\RapidJSON" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/.+")
source_group("Externak\\SFMT" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sfmt/.+") source_group("Externak\\SFMT" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sfmt/.+")
source_group("FraggleScript" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/fragglescript/.+") source_group("FraggleScript" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/fragglescript/.+")
source_group("Games\\Heretic Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_heretic/.+")
source_group("Games\\Hexen Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_hexen/.+") source_group("Games\\Hexen Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_hexen/.+")
source_group("Games\\Raven Shared" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_raven/.+") source_group("Games\\Raven Shared" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_raven/.+")
source_group("Games\\Strife Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_strife/.+") source_group("Games\\Strife Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_strife/.+")

View file

@ -467,11 +467,6 @@ public:
void SerializeUserVars(FSerializer &arc); void SerializeUserVars(FSerializer &arc);
virtual void Serialize(FSerializer &arc); virtual void Serialize(FSerializer &arc);
void VMSuperCall()
{
ObjectFlags |= OF_SuperCall;
}
void ClearClass() void ClearClass()
{ {
Class = NULL; Class = NULL;

View file

@ -1,63 +0,0 @@
/*
#include "info.h"
#include "a_pickups.h"
#include "a_artifacts.h"
#include "gstrings.h"
#include "p_local.h"
#include "s_sound.h"
#include "vm.h"
*/
// Tome of power ------------------------------------------------------------
class AArtiTomeOfPower : public APowerupGiver
{
DECLARE_CLASS (AArtiTomeOfPower, APowerupGiver)
public:
bool Use (bool pickup);
};
IMPLEMENT_CLASS(AArtiTomeOfPower, false, false)
bool AArtiTomeOfPower::Use (bool pickup)
{
if (Owner->player->morphTics && (Owner->player->MorphStyle & MORPH_UNDOBYTOMEOFPOWER))
{ // Attempt to undo chicken
if (!P_UndoPlayerMorph (Owner->player, Owner->player, MORPH_UNDOBYTOMEOFPOWER))
{ // Failed
if (!(Owner->player->MorphStyle & MORPH_FAILNOTELEFRAG))
{
P_DamageMobj (Owner, NULL, NULL, TELEFRAG_DAMAGE, NAME_Telefrag);
}
}
else
{ // Succeeded
S_Sound (Owner, CHAN_VOICE, "*evillaugh", 1, ATTN_IDLE);
}
return true;
}
else
{
return Super::Use (pickup);
}
}
// Time bomb ----------------------------------------------------------------
class AArtiTimeBomb : public AInventory
{
DECLARE_CLASS (AArtiTimeBomb, AInventory)
public:
bool Use (bool pickup);
};
IMPLEMENT_CLASS(AArtiTimeBomb, false, false)
bool AArtiTimeBomb::Use (bool pickup)
{
AActor *mo = Spawn("ActivatedTimeBomb",
Owner->Vec3Angle(24., Owner->Angles.Yaw, - Owner->Floorclip), ALLOW_REPLACE);
mo->target = Owner;
return true;
}

View file

@ -1,22 +0,0 @@
#include "actor.h"
#include "info.h"
#include "a_pickups.h"
#include "a_action.h"
#include "m_random.h"
#include "p_local.h"
#include "s_sound.h"
#include "gstrings.h"
#include "p_enemy.h"
#include "a_specialspot.h"
#include "g_level.h"
#include "a_sharedglobal.h"
#include "templates.h"
#include "r_data/r_translate.h"
#include "doomstat.h"
#include "d_player.h"
#include "a_morph.h"
#include "p_spec.h"
#include "serializer.h"
// Include all the other Heretic stuff here to reduce compile time
#include "a_hereticartifacts.cpp"

View file

@ -372,6 +372,15 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
return true; return true;
} }
DEFINE_ACTION_FUNCTION(_PlayerInfo, UndoPlayerMorph)
{
PARAM_SELF_STRUCT_PROLOGUE(player_t);
PARAM_POINTER(player, player_t);
PARAM_INT_DEF(unmorphflag);
PARAM_BOOL_DEF(force);
ACTION_RETURN_BOOL(P_UndoPlayerMorph(self, player, unmorphflag, force));
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// FUNC P_MorphMonster // FUNC P_MorphMonster

View file

@ -20,6 +20,7 @@
#include "d_player.h" #include "d_player.h"
#include "p_spec.h" #include "p_spec.h"
#include "serializer.h" #include "serializer.h"
#include "virtual.h"
static FRandom pr_restore ("RestorePos"); static FRandom pr_restore ("RestorePos");
@ -1005,6 +1006,30 @@ bool AInventory::Use (bool pickup)
return false; return false;
} }
DEFINE_ACTION_FUNCTION(AInventory, Use)
{
PARAM_SELF_PROLOGUE(AInventory);
PARAM_BOOL(pickup);
ACTION_RETURN_BOOL(self->Use(pickup));
}
bool AInventory::CallUse(bool pickup)
{
IFVIRTUAL(AInventory, Use)
{
VMValue params[2] = { (DObject*)this, pickup };
VMReturn ret;
VMFrameStack stack;
int retval;
ret.IntAt(&retval);
stack.Call(func, params, 2, &ret, 1, nullptr);
return !!retval;
}
else return Use(pickup);
}
//=========================================================================== //===========================================================================
// //
// AInventory :: Hide // AInventory :: Hide
@ -1494,7 +1519,7 @@ bool AInventory::TryPickup (AActor *&toucher)
copy->AttachToOwner (newtoucher); copy->AttachToOwner (newtoucher);
if (ItemFlags & IF_AUTOACTIVATE) if (ItemFlags & IF_AUTOACTIVATE)
{ {
if (copy->Use (true)) if (copy->CallUse (true))
{ {
if (--copy->Amount <= 0) if (--copy->Amount <= 0)
{ {

View file

@ -204,6 +204,7 @@ public:
virtual void GoAwayAndDie (); virtual void GoAwayAndDie ();
virtual bool HandlePickup (AInventory *item); virtual bool HandlePickup (AInventory *item);
virtual bool Use (bool pickup); virtual bool Use (bool pickup);
bool CallUse(bool pickup);
virtual void Travelled (); virtual void Travelled ();
virtual void OwnerDied (); virtual void OwnerDied ();

View file

@ -955,7 +955,7 @@ bool AActor::DoUseInventory (AInventory *item)
{ {
return false; return false;
} }
if (!item->Use (false)) if (!item->CallUse (false))
{ {
return false; return false;
} }
@ -974,7 +974,6 @@ DEFINE_ACTION_FUNCTION(AActor, UseInventory)
{ {
PARAM_SELF_PROLOGUE(AActor); PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT(item, AInventory); PARAM_OBJECT(item, AInventory);
self->VMSuperCall();
ACTION_RETURN_BOOL(self->DoUseInventory(item)); ACTION_RETURN_BOOL(self->DoUseInventory(item));
} }
@ -4149,7 +4148,6 @@ void AActor::Tick ()
DEFINE_ACTION_FUNCTION(AActor, Tick) DEFINE_ACTION_FUNCTION(AActor, Tick)
{ {
PARAM_SELF_PROLOGUE(AActor); PARAM_SELF_PROLOGUE(AActor);
self->VMSuperCall();
self->Tick(); self->Tick();
return 0; return 0;
} }
@ -4708,7 +4706,6 @@ DEFINE_ACTION_FUNCTION(AActor, Activate)
{ {
PARAM_SELF_PROLOGUE(AActor); PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT(activator, AActor); PARAM_OBJECT(activator, AActor);
self->VMSuperCall();
self->Activate(activator); self->Activate(activator);
return 0; return 0;
} }
@ -4756,7 +4753,6 @@ DEFINE_ACTION_FUNCTION(AActor, Deactivate)
{ {
PARAM_SELF_PROLOGUE(AActor); PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT(activator, AActor); PARAM_OBJECT(activator, AActor);
self->VMSuperCall();
self->Deactivate(activator); self->Deactivate(activator);
return 0; return 0;
} }
@ -6797,7 +6793,6 @@ DEFINE_ACTION_FUNCTION(AActor, DoSpecialDamage)
PARAM_OBJECT(target, AActor); PARAM_OBJECT(target, AActor);
PARAM_INT(damage); PARAM_INT(damage);
PARAM_NAME(damagetype); PARAM_NAME(damagetype);
self->VMSuperCall();
ACTION_RETURN_INT(self->DoSpecialDamage(target, damage, damagetype)); ACTION_RETURN_INT(self->DoSpecialDamage(target, damage, damagetype));
} }

View file

@ -47,7 +47,7 @@ Class ArtiInvisibility : PowerupGiver
// Tome of power ------------------------------------------------------------ // Tome of power ------------------------------------------------------------
Class ArtiTomeOfPower : PowerupGiver native Class ArtiTomeOfPower : PowerupGiver
{ {
Default Default
{ {
@ -65,6 +65,31 @@ Class ArtiTomeOfPower : PowerupGiver native
PWBK A 350; PWBK A 350;
Loop; Loop;
} }
bool Use (bool pickup)
{
Playerinfo p = Owner.player;
if (p && p.morphTics && (p.MorphStyle & MRF_UNDOBYTOMEOFPOWER))
{ // Attempt to undo chicken
if (!p.UndoPlayerMorph (p, MRF_UNDOBYTOMEOFPOWER))
{ // Failed
if (!(p.MorphStyle & MRF_FAILNOTELEFRAG))
{
Owner.DamageMobj (null, null, TELEFRAG_DAMAGE, 'Telefrag');
}
}
else
{ // Succeeded
Owner.A_PlaySound ("*evillaugh", CHAN_VOICE);
}
return true;
}
else
{
return Super.Use (pickup);
}
}
} }
@ -99,7 +124,7 @@ Class ActivatedTimeBomb : Actor
} }
Class ArtiTimeBomb : Inventory native Class ArtiTimeBomb : Inventory
{ {
Default Default
{ {
@ -120,4 +145,12 @@ Class ArtiTimeBomb : Inventory native
FBMB E 350; FBMB E 350;
Loop; Loop;
} }
override bool Use (bool pickup)
{
Actor mo = Spawn("ActivatedTimeBomb", Owner.Vec3Angle(24., Owner.angle, - Owner.Floorclip), ALLOW_REPLACE);
mo.target = Owner;
return true;
}
} }

View file

@ -25,6 +25,9 @@ class Inventory : Actor native
Inventory.PickupMessage "$TXT_DEFAULTPICKUPMSG"; Inventory.PickupMessage "$TXT_DEFAULTPICKUPMSG";
} }
virtual native bool Use (bool pickup);
// These are regular functions for the item itself. // These are regular functions for the item itself.
private native void A_RestoreSpecialDoomThing(); private native void A_RestoreSpecialDoomThing();
private native void A_RestoreSpecialThing1(); private native void A_RestoreSpecialThing1();

View file

@ -213,8 +213,10 @@ FWeaponSlots weapons;
*/ */
native bool UndoPlayerMorph(playerinfo player, int unmorphflag = 0, bool force = false);
native void SetPsprite(int id, State stat, bool pending = false); native void SetPsprite(int id, State stat, bool pending = false);
native void SetSafeFlash(Weapon weap, State flashstate, int index); native void SetSafeFlash(Weapon weap, State flashstate, int index);
native PSprite GetPSprite(int id); native PSprite GetPSprite(int id);
native PSprite FindPSprite(int id); native PSprite FindPSprite(int id);
} }