- Next round of things from Gez's experimental build:

* MBF's dog (definition only, no sprites yet.)
  * User variables. There's an array of 10. They can be set and checked in both DECORATE and ACS.
  * Made the tag name changeable but eliminated the redundancy of having both the meta property and the individual actor's one. Having one is fully sufficient. TO BE FIXED: Names are case insensitive but this should better be case sensitive. Unfortunately there's currently nothing better than FName to store a string inside an actor without severely complicating matters. Also bumped savegame version to avoid problems with this change.


SVN r1823 (trunk)
This commit is contained in:
Christoph Oelckers 2009-09-14 21:41:44 +00:00
parent ea8c94d637
commit a59de25107
20 changed files with 213 additions and 66 deletions

View file

@ -1,6 +1,16 @@
September 14, 2009 (Changes by Graf Zahl)
- Fixed: Argument count for UsePuzzleItem was wrong.
- Added a few things from Gez's experimental build:
* MBF's dog (definition only, no sprites yet.)
* User variables. There's an array of 10. They can be set and checked in
both DECORATE and ACS.
* Made the tag name changeable but eliminated the redundancy of having
both the meta property and the individual actor's one. Having one is
fully sufficient. TO BE FIXED: Names are case insensitive but this
should better be case sensitive. Unfortunately there's currently nothing
better than FName to store a string inside an actor without severely
complicating matters. Also bumped savegame version to avoid problems
with this change.
* MBF grenade and bouncing code.
* several compatibility options.
* info CCMD to print extended actor information (not fully implemented yet)

View file

@ -712,6 +712,7 @@ public:
fixed_t GetGravity() const;
bool IsSentient() const;
const char *GetTag(const char *def = NULL) const;
// info for drawing
@ -779,6 +780,7 @@ public:
int tid; // thing identifier
int special; // special
int args[5]; // special arguments
int uservar[10]; // user variables, accessible by DECORATE and ACS
AActor *inext, **iprev;// Links to other mobjs in same bucket
TObjPtr<AActor> goal; // Monster's goal if not chasing anything
@ -802,6 +804,7 @@ public:
int lastpush;
int activationtype; // How the thing behaves when activated with USESPECIAL or BUMPSPECIAL
int Score; // manipulated by score items, ACS or DECORATE. The engine doesn't use this itself for anything.
FNameNoInit Tag; // Strife's tag name. FIXME: should be case sensitive!
AActor *BlockingMobj; // Actor that blocked the last move
line_t *BlockingLine; // Line that blocked the last move

View file

@ -110,6 +110,24 @@ CVAR (Bool, chasedemo, false, 0);
CVAR (Bool, storesavepic, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Bool, longsavemessages, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (String, save_dir, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
EXTERN_CVAR (Float, con_midtime);
//==========================================================================
//
// CVAR displaynametags
//
// Selects whether to display name tags or not when changing weapons
//
//==========================================================================
CUSTOM_CVAR (Bool, displaynametags, 0, CVAR_ARCHIVE)
{
if (self != 0 && self != 1)
{
self = 0;
}
}
gameaction_t gameaction;
gamestate_t gamestate = GS_STARTUP;
@ -335,6 +353,10 @@ CCMD (invnext)
who->InvSel = who->Inventory;
}
}
if (displaynametags && StatusBar && SmallFont
&& gamestate == GS_LEVEL && level.time > con_midtime && who->InvSel)
StatusBar->AttachMessage (new DHUDMessage (SmallFont, who->InvSel->GetTag(),
2.5f, 0.375f, 0, 0, CR_YELLOW, con_midtime), MAKE_ID('S','I','N','V'));
}
who->player->inventorytics = 5*TICRATE;
}
@ -362,6 +384,10 @@ CCMD (invprev)
}
who->InvSel = item;
}
if (displaynametags && StatusBar && SmallFont
&& gamestate == GS_LEVEL && level.time > con_midtime && who->InvSel)
StatusBar->AttachMessage (new DHUDMessage (SmallFont, who->InvSel->GetTag(),
2.5f, 0.375f, 0, 0, CR_YELLOW, con_midtime), MAKE_ID('S','I','N','V'));
}
who->player->inventorytics = 5*TICRATE;
}
@ -385,9 +411,7 @@ CCMD(invquery)
AInventory *inv = players[consoleplayer].mo->InvSel;
if (inv != NULL)
{
const char *description = inv->GetClass()->Meta.GetMetaString(AMETA_StrifeName);
if (description == NULL) description = inv->GetClass()->TypeName;
Printf(PRINT_HIGH, "%s (%dx)\n", description, inv->Amount);
Printf(PRINT_HIGH, "%s (%dx)\n", inv->GetTag(), inv->Amount);
}
}

View file

@ -58,15 +58,9 @@ void AWeapon::Serialize (FArchive &arc)
<< MoveCombatDist
<< Ammo1 << Ammo2 << SisterWeapon << GivenAsMorphWeapon
<< bAltFire
<< ReloadCounter;
if (SaveVersion >= 1688)
{
arc << FOVScale;
if (SaveVersion >= 1700)
{
arc << Crosshair;
}
}
<< ReloadCounter
<< FOVScale
<< Crosshair;
}
//===========================================================================

View file

@ -636,11 +636,7 @@ private:
continue;
}
label = item->GetClass()->Meta.GetMetaString (AMETA_StrifeName);
if (label == NULL)
{
label = item->GetClass()->TypeName.GetChars();
}
label = item->GetTag();
int colnum = ((i-pos) / 5) & (KeyPopScroll > 0 ? 3 : 1);
int rownum = (i % 5) * 18;

View file

@ -93,6 +93,8 @@ EXTERN_CVAR(Int, showendoom)
EXTERN_CVAR(Bool, hud_althud)
EXTERN_CVAR(Int, compatmode)
EXTERN_CVAR (Bool, vid_vsync)
EXTERN_CVAR(Bool, displaynametags)
//
// defaulted values
//
@ -499,6 +501,7 @@ static menuitem_t VideoItems[] = {
{ discrete, "Rocket Trails", {&cl_rockettrails}, {4.0}, {0.0}, {0.0}, {RocketTrailTypes} },
{ discrete, "Blood Type", {&cl_bloodtype}, {3.0}, {0.0}, {0.0}, {BloodTypes} },
{ discrete, "Bullet Puff Type", {&cl_pufftype}, {2.0}, {0.0}, {0.0}, {PuffTypes} },
{ discrete, "Display nametags", {&displaynametags}, {2.0}, {0.0}, {0.0}, {YesNo} },
};
#define CROSSHAIR_INDEX 7

View file

@ -2426,7 +2426,7 @@ enum
APROP_Dropped = 18,
APROP_Notarget = 19,
APROP_Species = 20,
// APROP_Nametag
APROP_NameTag = 21,
APROP_Score = 22,
};
@ -2583,6 +2583,13 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
case APROP_Score:
actor->Score = value;
case APROP_NameTag:
actor->Tag = FBehavior::StaticLookupString(value);
break;
default:
// do nothing.
break;
}
}
@ -2695,6 +2702,7 @@ int DLevelScript::CheckActorProperty (int tid, int property, int value)
case APROP_DeathSound: string = actor->DeathSound; break;
case APROP_ActiveSound: string = actor->ActiveSound; break;
case APROP_Species: string = actor->GetSpecies(); break;
case APROP_NameTag: string = actor->GetTag(); break;
}
if (string == NULL) string = "";
return (!stricmp(string, FBehavior::StaticLookupString(value)));
@ -2881,6 +2889,8 @@ enum EACSFunctions
ACSF_SpawnSpotFacingForced,
ACSF_CheckActorProperty,
ACSF_SetActorVelocity,
ACSF_SetUserVariable,
ACSF_GetUserVariable,
};
int DLevelScript::SideFromID(int id, int side)
@ -3079,6 +3089,42 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args)
}
return 0;
case ACSF_SetUserVariable:
{
int cnt = 0;
if (args[1] >= 0 && args[1] < 10)
{
if (args[0] == 0)
{
if (activator != NULL)
{
activator->uservar[args[1]] = args[2];
}
cnt++;
}
else
{
TActorIterator<AActor> iterator (args[0]);
while ( (actor = iterator.Next ()) )
{
actor->uservar[args[1]] = args[2];
cnt++;
}
}
}
return cnt;
}
case ACSF_GetUserVariable:
if (args[1] >= 0 && args[1] < 10)
{
activator = SingleActorFromTID(args[0], NULL);
return activator != NULL? activator->uservar[args[1]] : 0;
}
else return 0;
default:
break;
}

View file

@ -875,11 +875,7 @@ static void DrawConversationMenu ()
}
else
{
speakerName = cp->ConversationNPC->GetClass()->Meta.GetMetaString (AMETA_StrifeName);
if (speakerName == NULL)
{
speakerName = "Person";
}
speakerName = cp->mo->GetTag("Person");
}
// Dim the screen behind the dialogue (but only if there is no backdrop).

View file

@ -280,36 +280,9 @@ void AActor::Serialize (FArchive &arc)
<< MeleeState
<< MissileState
<< MaxDropOffHeight
<< MaxStepHeight;
if (SaveVersion < 1796)
{
int BounceFlags, bounceflags;
arc << BounceFlags;
bounceflags = 0;
if (BounceFlags & 4)
bounceflags |= BOUNCE_UseSeeSound;
BounceFlags &= 3;
if (BounceFlags == 1) bounceflags |= BOUNCE_Doom;
else if (BounceFlags == 2) bounceflags |= BOUNCE_Heretic;
else if (BounceFlags == 3) bounceflags |= BOUNCE_Hexen;
if (flags3 & 0x00800000)
flags3 &= ~0x00800000, bounceflags |= BOUNCE_CanBounceWater;
if (flags3 & 0x01000000)
flags3 &= ~0x01000000, bounceflags |= BOUNCE_NoWallSound;
if (flags4 & 0x80000000)
flags4 &= ~0x80000000, bounceflags |= BOUNCE_Quiet;
if (flags5 & 0x00000008)
flags5 &= ~0x00000008, bounceflags |= BOUNCE_AllActors;
if (flags5 & 0x00000010)
flags5 &= ~0x00000010, bounceflags |= BOUNCE_ExplodeOnWater;
BounceFlags = bounceflags;
}
else
{
arc << BounceFlags;
}
arc << bouncefactor
<< MaxStepHeight
<< BounceFlags
<< bouncefactor
<< wallbouncefactor
<< bouncecount
<< maxtargetrange
@ -323,10 +296,11 @@ void AActor::Serialize (FArchive &arc)
<< BlockingMobj
<< BlockingLine
<< pushfactor
<< Species;
<< Species
<< Score
<< Tag;
if (SaveVersion >= 1819)
arc << Score;
for(int i=0; i<10; i++) arc << uservar[i];
if (arc.IsStoring ())
{
@ -5446,6 +5420,14 @@ bool AActor::IsSentient() const
}
const char *AActor::GetTag(const char *def) const
{
if (Tag != NAME_None) return Tag.GetChars();
else if (def) return def;
else return GetClass()->TypeName.GetChars();
}
//----------------------------------------------------------------------------
//
// DropItem handling

View file

@ -2852,3 +2852,22 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecial)
self->args[4] = arg4;
}
//===========================================================================
//
// A_SetVar
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserVar)
{
ACTION_PARAM_START(2);
ACTION_PARAM_INT(pos, 0);
ACTION_PARAM_INT(value, 1);
if (pos < 0 || pos > 9)
return;
// Set the value of the specified arg
self->uservar[pos] = value;
}

View file

@ -78,6 +78,7 @@ DEFINE_MEMBER_VARIABLE_ALIAS(momy, vely, AActor)
DEFINE_MEMBER_VARIABLE_ALIAS(momz, velz, AActor)
DEFINE_MEMBER_VARIABLE(Damage, AActor)
DEFINE_MEMBER_VARIABLE(Score, AActor)
DEFINE_MEMBER_VARIABLE(uservar, AActor)
//==========================================================================
//

View file

@ -302,7 +302,7 @@ DEFINE_PROPERTY(skip_super, 0, Actor)
DEFINE_PROPERTY(tag, S, Actor)
{
PROP_STRING_PARM(str, 0);
info->Class->Meta.SetMetaString(AMETA_StrifeName, str);
defaults->Tag = str;
}
//==========================================================================

View file

@ -75,7 +75,7 @@
// SAVESIG should match SAVEVER.
// MINSAVEVER is the minimum level snapshot version that can be loaded.
#define MINSAVEVER 1643
#define MINSAVEVER 1823
#if SVN_REVISION_NUMBER < MINSAVEVER
// Never write a savegame with a version lower than what we need

View file

@ -26,6 +26,7 @@ ACTOR Actor native //: Thinker
native fixed_t alpha;
native angle_t angle;
native int args[5];
native int uservar[10];
native fixed_t ceilingz;
native fixed_t floorz;
native int health;
@ -254,6 +255,7 @@ ACTOR Actor native //: Thinker
action native A_ScaleVelocity(float scale);
action native A_ChangeVelocity(float x = 0, float y = 0, float z = 0, int flags = 0);
action native A_SetArg(int pos, int value);
action native A_SetVar(int pos, int value);
action native A_SetSpecial(int spec, int arg0, int arg1, int arg2, int arg3, int arg4);
States

View file

@ -0,0 +1,45 @@
ACTOR Dog 888
{
Game Doom
Health 500
Speed 10
PainChance 180
Radius 12
Height 28
Mass 100
Monster
+JUMPDOWN
ActiveSound "dog/active"
AttackSound "dog/attack"
DeathSound "dog/death"
PainSound "dog/pain"
SeeSound "dog/sight"
Obituary "$OB_DOG"
States
{
Spawn:
DOGS AB 10 A_Look
Loop
See:
DOGS AABBCCDD 2 A_Chase
Loop
Melee:
DOGS EF 8 A_FaceTarget
DOGS G 8 A_SargAttack
Goto See
Pain:
DOGS H 2
DOGS H 2 A_Pain
Goto See
Death:
DOGS I 8
DOGS J 8 A_Scream
DOGS K 4
DOGS L 4 A_Fall
DOGS M 4
DOGS N -1
Raise:
DOGS NMLKJI 5
Goto See
}
}

View file

@ -78,3 +78,15 @@ F84AB4557464A383E93F37CD3A82AC48 // MM2 map03
{
anybossdeath
}
// Arch-Vile ghost monster effect is used by the following maps
145C4DFCF843F2B92C73036BA0E1D98A // Hell Revealed map26
5379C080299EB961792B50AD96821543 // Hell to Pay map14
7837B5334A277F107515D649BCEFB682 // Hell to Pay map22
2EEB1E12FA9F9545DE9D99990A4A78E5 // Icarus map24
65A53A09A09525AE42EA210BF879CD37 // Plutonia 2 map32
2499CF9A9351BE9BC4E9C66FC9F291A7 // Requiem map23
{
corpsegibs
vileghosts
}

View file

@ -45,6 +45,7 @@
#include "actors/doom/spidermaster.txt"
#include "actors/doom/keen.txt"
#include "actors/doom/bossbrain.txt"
#include "actors/doom/dog.txt"
#include "actors/doom/deadthings.txt"
#include "actors/doom/doomammo.txt"

View file

@ -172,15 +172,15 @@ ActionList
Chase, Chase, Chase, Chase, Chase, Chase, Chase, Chase,
FaceTarget, FaceTarget, SargAttack, NULL, Pain, NULL, Scream,
NULL, Fall, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, BFGsound,
NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/,
NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/,
NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/,
NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/,
NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/, NULL/*FireOldBFG*/,
FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG,
FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG,
FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG,
FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG,
FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG, FireOldBFG,
Light0, ReFire, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
Look, Chase, Chase, Chase, CHase, FaceTarget,
NULL/*BetaSkullAttack*/, NULL, NULL, Pain, NULL,
Look, Chase, Chase, Chase, Chase, FaceTarget,
BetaSkullAttack, NULL, NULL, Pain, NULL,
NULL, NULL, NULL, NULL, Scream, NULL, Fall, Stop,
Mushroom
};

View file

@ -115,6 +115,10 @@ PD_YELLOWSO = "You need a yellow skull to activate this object";
GGSAVED = "game saved.";
HUSTR_MSGU = "[Message unsent]";
PICKUP_PISTOL_DROPPED = "Picked up a pistol.";
BETA_BONUS1 = "You pick up a demonic dagger.";
BETA_BONUS2 = "You pick up a skullchest.";
BETA_BONUS3 = "You pick up an evil sceptre.";
BETA_BONUS4 = "You pick up an unholy bible.";
// Level names
HUSTR_E1M1 = "E1M1: Hangar";
@ -634,6 +638,7 @@ OB_SPIDER = "%o stood in awe of the spider demon.";
OB_BABY = "%o let an arachnotron get %h.";
OB_CYBORG = "%o was splattered by a cyberdemon.";
OB_WOLFSS = "%o met a Nazi.";
OB_DOG = "%o was mauled by a dog.";
OB_CHICKEN = "%o was pecked to death.";
OB_BEAST = "%o was charred by a weredragon.";
@ -707,6 +712,7 @@ OB_MPBFG_BOOM = "%o was splintered by %k's BFG.";
OB_MPBFG_SPLASH = "%o couldn't hide from %k's BFG.";
OB_MPTELEFRAG = "%o was telefragged by %k.";
OB_RAILGUN = "%o was railed by %k.";
OB_MPBFG_MBF = "%o was burned by %k's BFG.";
// Same as OB_MPTELEFRAG, but shown when a monster telefrags you
OB_MONTELEFRAG = "%o was telefragged.";

View file

@ -425,6 +425,13 @@ brain/cube dsboscub
brain/cubeboom dsfirxpl
$alias brain/spawn misc/teleport
// Marine's Best Friend
dog/active dsdgact
dog/attack dsdgatk
dog/death dsdgdth
dog/pain dsdgpain
dog/sight dsdgsit
//============================================================================
//