Back to the Vavoom Forum Archives


Forum

Patch for additions to DECORATE

Wed, 03 Mar 2010 21:42:02

Firebrand

I've added a new powerup class, infinite ammo, I also added a way to get a bit more details in the DECORATE parsing of the engine, activated from the launcher and fixed a crash with Strife animated doors (the missing transitions remain a mystery for me yet...).
Index: basev/common/basepak.ls.in
===================================================================
--- basev/common/basepak.ls.in	(revision 4132)
+++ basev/common/basepak.ls.in	(working copy)
@@ -190,6 +190,7 @@
 progs/linespec/PowerDamage.vc				@CMAKE_SOURCE_DIR@/progs/common/linespec/PowerDamage.vc
 progs/linespec/PowerFlight.vc				@CMAKE_SOURCE_DIR@/progs/common/linespec/PowerFlight.vc
 progs/linespec/PowerGhost.vc				@CMAKE_SOURCE_DIR@/progs/common/linespec/PowerGhost.vc
+progs/linespec/PowerInfiniteAmmo.vc			@CMAKE_SOURCE_DIR@/progs/common/linespec/PowerInfiniteAmmo.vc
 progs/linespec/PowerInvisibility.vc			@CMAKE_SOURCE_DIR@/progs/common/linespec/PowerInvisibility.vc
 progs/linespec/PowerInvulnerable.vc			@CMAKE_SOURCE_DIR@/progs/common/linespec/PowerInvulnerable.vc
 progs/linespec/PowerIronFeet.vc				@CMAKE_SOURCE_DIR@/progs/common/linespec/PowerIronFeet.vc
Index: basev/common/vavoom_decorate_defs.xml
===================================================================
--- basev/common/vavoom_decorate_defs.xml	(revision 4132)
+++ basev/common/vavoom_decorate_defs.xml	(working copy)
@@ -324,7 +324,7 @@
 	<class name="PowerupGiver">
 		<prop_powerup_colour name="Powerup.Color" />
 		<prop_tics name="Powerup.Duration" property="EffectTime" />
-		<prop_class name="Powerup.Type" property="PowerupType" prefix="Power" />
+		<prop_power_class name="Powerup.Type" property="PowerupType" prefix="Power" />
 		<prop_name name="Powerup.Mode" property="Mode" />
 	</class>
 
Index: docs/changes3.log
===================================================================
--- docs/changes3.log	(revision 4132)
+++ docs/changes3.log	(working copy)
@@ -4021,3 +4021,8 @@
 02.03.2010
   I split memory and array streams to their own files, added serialisation
  operator to array and used it in some places.
+03.03.2010
+  Firebrand added the possibility of obtaining optional debug output from DECORATE parsing.
+  Firebrand added an infinite ammo powerup class.
+  Firebrand added a special property for powerup type parsing.
+  Firebrand fixed a crash with Strife's animated doors.
\ No newline at end of file
Index: msvc/vavoom.vcproj
===================================================================
--- msvc/vavoom.vcproj	(revision 4132)
+++ msvc/vavoom.vcproj	(working copy)
@@ -231,6 +231,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\source\arraystream.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\source\bitstream.cpp"
 				>
 			</File>
@@ -299,6 +303,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\source\memorystream.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\source\misc.cpp"
 				>
 			</File>
@@ -500,6 +508,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\source\arraystream.h"
+				>
+			</File>
+			<File
 				RelativePath="..\source\asm_i386.h"
 				>
 			</File>
@@ -580,6 +592,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\source\memorystream.h"
+				>
+			</File>
+			<File
 				RelativePath="..\source\misc.h"
 				>
 			</File>
Index: progs/common/linespec/classes.vc
===================================================================
--- progs/common/linespec/classes.vc	(revision 4132)
+++ progs/common/linespec/classes.vc	(working copy)
@@ -97,6 +97,7 @@
 #include "PowerStrength.vc"
 #include "PowerInvisibility.vc"
 #include "PowerGhost.vc"
+#include "PowerInfiniteAmmo.vc"
 #include "PowerShadow.vc"
 #include "PowerIronFeet.vc"
 #include "PowerMask.vc"
Index: progs/common/linespec/LineSpecialLevelInfo.vc
===================================================================
--- progs/common/linespec/LineSpecialLevelInfo.vc	(revision 4132)
+++ progs/common/linespec/LineSpecialLevelInfo.vc	(working copy)
@@ -1472,7 +1472,7 @@
 			{
 				continue;
 			}
-			for (i = 0; i < i < Sec->linecount; i++)
+			for (i = 0; i < Sec->linecount; i++)
 			{
 				Line = Sec->lines;
 				if (!Line->backsector)
Index: progs/common/linespec/PlayerEx.vc
===================================================================
--- progs/common/linespec/PlayerEx.vc	(revision 4132)
+++ progs/common/linespec/PlayerEx.vc	(working copy)
@@ -34,7 +34,8 @@
 	CF_NOCLIP		= 1 << 0,		// No clipping, walk through barriers.
 	CF_GODMODE		= 1 << 1,		// No damage, no health loss.
 	CF_REGENERATION	= 1 << 2,		// Regenerate Health points.
-	CF_FRIGHTENING	= 1 << 3		// Scare monsters away.
+	CF_FRIGHTENING	= 1 << 3,		// Scare monsters away.
+	CF_INFINITEAMMO = 1 << 4		// Player owns an infinite ammo artifact.
 };
 
 const float USERANGE		= 64.0;
Index: progs/common/linespec/TextureChangeDoor.vc
===================================================================
--- progs/common/linespec/TextureChangeDoor.vc	(revision 4132)
+++ progs/common/linespec/TextureChangeDoor.vc	(working copy)
@@ -151,7 +151,7 @@
 		if (Timer <= 0.0)
 		{
 			CurrentFrame++;
-			if (CurrentFrame >= Def->NumFrames )
+			if (CurrentFrame >= Def->NumFrames)
 			{
 				Line1->flags &= ~ML_BLOCKING;
 				Line2->flags &= ~ML_BLOCKING;
Index: progs/common/linespec/Weapon.vc
===================================================================
--- progs/common/linespec/Weapon.vc	(revision 4132)
+++ progs/common/linespec/Weapon.vc	(working copy)
@@ -523,6 +523,12 @@
 
 bool CheckAmmo(byte Mode, bool AutoSwitch, optional bool RequireAmmo)
 {
+	if (Owner.bIsPlayer && PlayerEx(Owner.Player).Cheats & PlayerEx::CF_INFINITEAMMO)
+	{
+		// Don't waste ammo if we have an infinite ammo powerup
+		return true;
+	}
+
 	if (Mode == FIRE_Either)
 	{
 		if (CheckAmmo(FIRE_Primary, false) || CheckAmmo(FIRE_Secondary, false))
@@ -582,6 +588,11 @@
 final bool DepleteAmmo(byte Mode, optional bool CheckEnough,
 	optional int DehackedUse)
 {
+	if (Owner.bIsPlayer && PlayerEx(Owner.Player).Cheats & PlayerEx::CF_INFINITEAMMO)
+	{
+		// Don't waste ammo if we have an infinite ammo powerup
+		return true;
+	}
 	//	Default parameter values
 	if (!specified_CheckEnough)
 	{
Index: source/gamedefs.h
===================================================================
--- source/gamedefs.h	(revision 4132)
+++ source/gamedefs.h	(working copy)
@@ -45,7 +45,7 @@
 #include "array.h"		//	Dynamic arrays
 #include "map.h"		//	Mapping of keys to values
 #include "memorystream.h"//	In-memory streams
-#include "arraystream.h"//	Stream for reding from array
+#include "arraystream.h"//	Stream for reading from array
 #include "bitstream.h"	//	Streams for bit-data
 #include "names.h"		//	Built-in names
 #include "name.h"		//	Names
Index: source/vc_decorate.cpp
===================================================================
--- source/vc_decorate.cpp	(revision 4132)
+++ source/vc_decorate.cpp	(working copy)
@@ -30,8 +30,6 @@
 
 // MACROS ------------------------------------------------------------------
 
-#define DEBUG_PARSING
-
 // TYPES -------------------------------------------------------------------
 
 enum
@@ -75,6 +73,7 @@
 	PROP_Str,
 	PROP_StrUnsupported,
 	PROP_Class,
+	PROP_Power_Class,
 	PROP_BoolConst,
 	PROP_State,
 	PROP_Game,
@@ -364,6 +363,15 @@
 					P.CPrefix = PN->GetAttribute("prefix");
 				}
 			}
+			else if (PN->Name == "prop_power_class")
+			{
+				VPropDef& P = Lst.NewProp(PROP_Power_Class, PN);
+				P.SetField(Lst.Class, *PN->GetAttribute("property"));
+				if (PN->HasAttribute("prefix"))
+				{
+					P.CPrefix = PN->GetAttribute("prefix");
+				}
+			}
 			else if (PN->Name == "prop_bool_const")
 			{
 				VPropDef& P = Lst.NewProp(PROP_BoolConst, PN);
@@ -2286,7 +2294,7 @@
 	int ColonPos = sc->String.IndexOf(':');
 	if (ColonPos >= 0)
 	{
-		//	There's a colon inside, so plit up the string.
+		//	There's a colon inside, so split up the string.
 		NameStr = VStr(sc->String, 0, ColonPos);
 		ParentStr = VStr(sc->String, ColonPos + 1, sc->String.Length() -
 			ColonPos - 1);
@@ -2296,14 +2304,15 @@
 		NameStr = sc->String;
 	}
 
-#ifdef DEBUG_PARSING
-	sc->Message(va("Parsing class %s", *NameStr));
-#endif
+	if (GArgs.CheckParm("-debug_decorate"))
+	{
+		sc->Message(va("Parsing class %s", *NameStr));
+	}
 
 	VClass* DupCheck = VClass::FindClassLowerCase(*NameStr.ToLower());
 	if (DupCheck && DupCheck->MemberType == MEMBER_Class)
 	{
-		sc->Error(va("Redeclared class %s", *NameStr));
+		sc->Message(va("Warning: Redeclared class %s", *NameStr));
 	}
 
 	if (ColonPos < 0)
@@ -2533,6 +2542,13 @@
 					sc->ExpectString();
 					AddClassFixup(Class, P.Field, P.CPrefix + sc->String, ClassFixups);
 					break;
+				case PROP_Power_Class:
+					// This is a very inconvenient shit!
+					// but ZDoom had to prepend "power" to the name...
+					sc->ExpectString();
+					AddClassFixup(Class, P.Field, sc->String.StartsWith("Power") || sc->String.StartsWith("power") ?
+							sc->String : P.CPrefix + sc->String, ClassFixups);
+					break;
 				case PROP_BoolConst:
 					P.Field->SetBool(DefObj, P.IConst);
 					break;
@@ -4128,17 +4144,19 @@
 	//	Emit code.
 	for (int i = 0; i < DecPkg->ParsedClasses.Num(); i++)
 	{
-#ifdef DEBUG_PARSING
-		GCon->Logf("Class %s", *DecPkg->ParsedClasses->GetFullName());
-#endif
+		if (GArgs.CheckParm("-debug_decorate"))
+		{
+			GCon->Logf("Class %s", DecPkg->ParsedClasses->GetFullName());
+		}
 		DecPkg->ParsedClasses->DecorateEmit();
 	}
 	//	Compile and set up for execution.
 	for (int i = 0; i < DecPkg->ParsedClasses.Num(); i++)
 	{
-#ifdef DEBUG_PARSING
-		GCon->Logf("Class %s", *DecPkg->ParsedClasses->GetFullName());
-#endif
+		if (GArgs.CheckParm("-debug_decorate"))
+		{
+			GCon->Logf("Class %s", DecPkg->ParsedClasses->GetFullName());
+		}
 		DecPkg->ParsedClasses->DecoratePostLoad();
 	}
 
Index: utils/vlaunch/vlaunch.cpp
===================================================================
--- utils/vlaunch/vlaunch.cpp	(revision 4132)
+++ utils/vlaunch/vlaunch.cpp	(working copy)
@@ -66,6 +66,7 @@
 	wxCheckBox*		CheckBoxNoMouse;
 	wxCheckBox*		CheckBoxNoJoy;
 	wxCheckBox*		CheckBoxDebug;
+	wxCheckBox*		CheckBoxDECORATEDebug;
 	wxTextCtrl*		EditIWadDir;
 	wxTextCtrl*		EditGame;
 	wxCheckBox*		CheckBoxDevGame;
@@ -167,6 +168,9 @@
 	CheckBoxDebug = new wxCheckBox(page, -1, wxT("Create debug file"));
 	gsizer->AddSpacer(1);
 	gsizer->Add(CheckBoxDebug, 0, wxALL, 4);
+	CheckBoxDECORATEDebug = new wxCheckBox(page, -1, wxT("Debug DECORATE Parsing"));
+	gsizer->AddSpacer(1);
+	gsizer->Add(CheckBoxDECORATEDebug, 0, wxALL, 4);
 	gsizer->Add(new wxStaticText(page, -1, wxT("Other options:")), 0, wxALL, 4);
 	EditMisc = new wxTextCtrl(page, -1, wxT(""), wxDefaultPosition, wxSize(209, -1));
 	gsizer->Add(EditMisc, 0, wxALL, 4);
@@ -293,6 +297,7 @@
 	CheckBoxNoMouse->SetValue(!!Conf->Read(wxT("NoMouse"), 0l));
 	CheckBoxNoJoy->SetValue(!!Conf->Read(wxT("NoJoy"), 0l));
 	CheckBoxDebug->SetValue(!!Conf->Read(wxT("Debug"), 0l));
+	CheckBoxDECORATEDebug->SetValue(!!Conf->Read(wxT("DECORATEDebug"), 0l));
 	EditIWadDir->SetValue(Conf->Read(wxT("IWadDir"), wxT("")));
 	EditGame->SetValue(Conf->Read(wxT("CustomGame"), wxT("")));
 	CheckBoxDevGame->SetValue(!!Conf->Read(wxT("DevGame"), 0l));
@@ -328,6 +333,7 @@
 	Conf->Write(wxT("NoMouse"), CheckBoxNoMouse->IsChecked());
 	Conf->Write(wxT("NoJoy"), CheckBoxNoJoy->IsChecked());
 	Conf->Write(wxT("Debug"), CheckBoxDebug->IsChecked());
+	Conf->Write(wxT("DECORATEDebug"), CheckBoxDECORATEDebug->IsChecked());
 	Conf->Write(wxT("IWadDir"), EditIWadDir->GetValue());
 	Conf->Write(wxT("CustomGame"), EditGame->GetValue());
 	Conf->Write(wxT("DevGame"), CheckBoxDevGame->IsChecked());
@@ -420,6 +426,8 @@
 	// Misc
 	if (CheckBoxDebug->IsChecked())
 		CmdLine += wxT(" -debug");
+	if (CheckBoxDECORATEDebug->IsChecked())
+		CmdLine += wxT(" -debug_decorate");
 	if (EditGame->GetValue().Length())
 	{
 		if (CheckBoxDevGame->IsChecked())
Thu, 04 Mar 2010 18:45:02

Janis Legzdinsh

Index: progs/common/linespec/PlayerEx.vc
===================================================================
--- progs/common/linespec/PlayerEx.vc	(revision 4132)
+++ progs/common/linespec/PlayerEx.vc	(working copy)
@@ -34,7 +34,8 @@
 	CF_NOCLIP		= 1 << 0,		// No clipping, walk through barriers.
 	CF_GODMODE		= 1 << 1,		// No damage, no health loss.
 	CF_REGENERATION	= 1 << 2,		// Regenerate Health points.
-	CF_FRIGHTENING	= 1 << 3		// Scare monsters away.
+	CF_FRIGHTENING	= 1 << 3,		// Scare monsters away.
+	CF_INFINITEAMMO = 1 << 4		// Player owns an infinite ammo artifact.
 };
 
 const float USERANGE		= 64.0;
Index: progs/common/linespec/Weapon.vc
===================================================================
--- progs/common/linespec/Weapon.vc	(revision 4132)
+++ progs/common/linespec/Weapon.vc	(working copy)
@@ -523,6 +523,12 @@
 
 bool CheckAmmo(byte Mode, bool AutoSwitch, optional bool RequireAmmo)
 {
+	if (Owner.bIsPlayer && PlayerEx(Owner.Player).Cheats & PlayerEx::CF_INFINITEAMMO)
+	{
+		// Don't waste ammo if we have an infinite ammo powerup
+		return true;
+	}
+
 	if (Mode == FIRE_Either)
 	{
 		if (CheckAmmo(FIRE_Primary, false) || CheckAmmo(FIRE_Secondary, false))
@@ -582,6 +588,11 @@
 final bool DepleteAmmo(byte Mode, optional bool CheckEnough,
 	optional int DehackedUse)
 {
+	if (Owner.bIsPlayer && PlayerEx(Owner.Player).Cheats & PlayerEx::CF_INFINITEAMMO)
+	{
+		// Don't waste ammo if we have an infinite ammo powerup
+		return true;
+	}
 	//	Default parameter values
 	if (!specified_CheckEnough)
 	{
I don't like that it uses a cheat flag. I think it's much cleaner to check if actor's inventory contains the powerup.
Index: utils/vlaunch/vlaunch.cpp
===================================================================
--- utils/vlaunch/vlaunch.cpp	(revision 4132)
+++ utils/vlaunch/vlaunch.cpp	(working copy)
@@ -66,6 +66,7 @@
 	wxCheckBox*		CheckBoxNoMouse;
 	wxCheckBox*		CheckBoxNoJoy;
 	wxCheckBox*		CheckBoxDebug;
+	wxCheckBox*		CheckBoxDECORATEDebug;
 	wxTextCtrl*		EditIWadDir;
 	wxTextCtrl*		EditGame;
 	wxCheckBox*		CheckBoxDevGame;
@@ -167,6 +168,9 @@
 	CheckBoxDebug = new wxCheckBox(page, -1, wxT("Create debug file"));
 	gsizer->AddSpacer(1);
 	gsizer->Add(CheckBoxDebug, 0, wxALL, 4);
+	CheckBoxDECORATEDebug = new wxCheckBox(page, -1, wxT("Debug DECORATE Parsing"));
+	gsizer->AddSpacer(1);
+	gsizer->Add(CheckBoxDECORATEDebug, 0, wxALL, 4);
 	gsizer->Add(new wxStaticText(page, -1, wxT("Other options:")), 0, wxALL, 4);
 	EditMisc = new wxTextCtrl(page, -1, wxT(""), wxDefaultPosition, wxSize(209, -1));
 	gsizer->Add(EditMisc, 0, wxALL, 4);
@@ -293,6 +297,7 @@
 	CheckBoxNoMouse->SetValue(!!Conf->Read(wxT("NoMouse"), 0l));
 	CheckBoxNoJoy->SetValue(!!Conf->Read(wxT("NoJoy"), 0l));
 	CheckBoxDebug->SetValue(!!Conf->Read(wxT("Debug"), 0l));
+	CheckBoxDECORATEDebug->SetValue(!!Conf->Read(wxT("DECORATEDebug"), 0l));
 	EditIWadDir->SetValue(Conf->Read(wxT("IWadDir"), wxT("")));
 	EditGame->SetValue(Conf->Read(wxT("CustomGame"), wxT("")));
 	CheckBoxDevGame->SetValue(!!Conf->Read(wxT("DevGame"), 0l));
@@ -328,6 +333,7 @@
 	Conf->Write(wxT("NoMouse"), CheckBoxNoMouse->IsChecked());
 	Conf->Write(wxT("NoJoy"), CheckBoxNoJoy->IsChecked());
 	Conf->Write(wxT("Debug"), CheckBoxDebug->IsChecked());
+	Conf->Write(wxT("DECORATEDebug"), CheckBoxDECORATEDebug->IsChecked());
 	Conf->Write(wxT("IWadDir"), EditIWadDir->GetValue());
 	Conf->Write(wxT("CustomGame"), EditGame->GetValue());
 	Conf->Write(wxT("DevGame"), CheckBoxDevGame->IsChecked());
@@ -420,6 +426,8 @@
 	// Misc
 	if (CheckBoxDebug->IsChecked())
 		CmdLine += wxT(" -debug");
+	if (CheckBoxDECORATEDebug->IsChecked())
+		CmdLine += wxT(" -debug_decorate");
 	if (EditGame->GetValue().Length())
 	{
 		if (CheckBoxDevGame->IsChecked())
I don't think it's a good idea to expose such debug parameters in launcher. You can always specify it in other options box.
Thu, 04 Mar 2010 21:09:07

Firebrand

OK then, I'll make the fixes you mention here and commit the changes <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->.
Sat, 06 Mar 2010 19:15:23

Janis Legzdinsh

You forgot to commit PowerInfiniteAmmo.vc
Sat, 06 Mar 2010 23:06:36

Firebrand

Oops. It's committed now, also, I think it's good to be releasing a new version now, after the release we can continue adding more stuff.

Back to the Vavoom Forum Archives