2006-02-24 04:48:15 +00:00
|
|
|
/*
|
|
|
|
** thingdef.cpp
|
|
|
|
**
|
|
|
|
** Actor definitions
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
2008-10-25 17:38:00 +00:00
|
|
|
** Copyright 2002-2008 Christoph Oelckers
|
|
|
|
** Copyright 2004-2008 Randy Heit
|
2006-02-24 04:48:15 +00:00
|
|
|
** All rights reserved.
|
|
|
|
**
|
|
|
|
** Redistribution and use in source and binary forms, with or without
|
|
|
|
** modification, are permitted provided that the following conditions
|
|
|
|
** are met:
|
|
|
|
**
|
|
|
|
** 1. Redistributions of source code must retain the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer.
|
|
|
|
** 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer in the
|
|
|
|
** documentation and/or other materials provided with the distribution.
|
|
|
|
** 3. The name of the author may not be used to endorse or promote products
|
|
|
|
** derived from this software without specific prior written permission.
|
|
|
|
** 4. When not used as part of ZDoom or a ZDoom derivative, this code will be
|
|
|
|
** covered by the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation; either version 2 of the License, or (at
|
|
|
|
** your option) any later version.
|
|
|
|
**
|
|
|
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "gi.h"
|
|
|
|
#include "actor.h"
|
|
|
|
#include "info.h"
|
|
|
|
#include "sc_man.h"
|
|
|
|
#include "tarray.h"
|
|
|
|
#include "w_wad.h"
|
|
|
|
#include "templates.h"
|
|
|
|
#include "r_defs.h"
|
|
|
|
#include "r_draw.h"
|
|
|
|
#include "a_pickups.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "cmdlib.h"
|
|
|
|
#include "p_lnspec.h"
|
|
|
|
#include "a_action.h"
|
|
|
|
#include "decallib.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "i_system.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "doomerrors.h"
|
2006-03-12 22:04:49 +00:00
|
|
|
#include "a_hexenglobal.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "a_weaponpiece.h"
|
|
|
|
#include "p_conversation.h"
|
2006-05-06 03:25:12 +00:00
|
|
|
#include "v_text.h"
|
2006-04-15 15:00:29 +00:00
|
|
|
#include "thingdef.h"
|
2008-10-25 17:38:00 +00:00
|
|
|
#include "thingdef_exp.h"
|
2006-08-17 09:54:42 +00:00
|
|
|
#include "a_sharedglobal.h"
|
2009-10-15 03:58:23 +00:00
|
|
|
#include "vmbuilder.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-10-25 17:38:00 +00:00
|
|
|
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
|
|
|
void InitThingdef();
|
|
|
|
void ParseDecorate (FScanner &sc);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-10-25 17:38:00 +00:00
|
|
|
// STATIC FUNCTION PROTOTYPES --------------------------------------------
|
2006-05-10 02:40:43 +00:00
|
|
|
const PClass *QuestItemClasses[31];
|
2008-10-25 17:38:00 +00:00
|
|
|
PSymbolTable GlobalSymbols;
|
2007-04-22 21:01:35 +00:00
|
|
|
|
2007-05-28 22:18:51 +00:00
|
|
|
//==========================================================================
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
2007-05-28 22:18:51 +00:00
|
|
|
// Starts a new actor definition
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
2007-05-28 22:18:51 +00:00
|
|
|
//==========================================================================
|
2009-02-21 21:44:15 +00:00
|
|
|
FActorInfo *CreateNewActor(const FScriptPosition &sc, FName typeName, FName parentName, bool native)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-07-21 17:03:30 +00:00
|
|
|
const PClass *replacee = NULL;
|
|
|
|
PClass *ti = NULL;
|
|
|
|
FActorInfo *info = NULL;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-09-21 22:25:23 +00:00
|
|
|
PClass *parent = RUNTIME_CLASS(AActor);
|
2007-05-28 22:18:51 +00:00
|
|
|
|
2008-09-21 22:25:23 +00:00
|
|
|
if (parentName != NAME_None)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-09-21 22:25:23 +00:00
|
|
|
parent = const_cast<PClass *> (PClass::FindClass (parentName));
|
2009-02-19 14:36:37 +00:00
|
|
|
|
|
|
|
const PClass *p = parent;
|
|
|
|
while (p != NULL)
|
|
|
|
{
|
|
|
|
if (p->TypeName == typeName)
|
|
|
|
{
|
|
|
|
sc.Message(MSG_ERROR, "'%s' inherits from a class with the same name", typeName.GetChars());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
p = p->ParentClass;
|
|
|
|
}
|
2007-05-28 22:18:51 +00:00
|
|
|
|
2008-09-21 22:25:23 +00:00
|
|
|
if (parent == NULL)
|
2007-05-28 22:18:51 +00:00
|
|
|
{
|
2009-02-19 14:36:37 +00:00
|
|
|
sc.Message(MSG_ERROR, "Parent type '%s' not found in %s", parentName.GetChars(), typeName.GetChars());
|
|
|
|
parent = RUNTIME_CLASS(AActor);
|
2007-05-28 22:18:51 +00:00
|
|
|
}
|
2008-09-21 22:25:23 +00:00
|
|
|
else if (!parent->IsDescendantOf(RUNTIME_CLASS(AActor)))
|
2007-04-22 21:01:35 +00:00
|
|
|
{
|
2009-02-19 14:36:37 +00:00
|
|
|
sc.Message(MSG_ERROR, "Parent type '%s' is not an actor in %s", parentName.GetChars(), typeName.GetChars());
|
|
|
|
parent = RUNTIME_CLASS(AActor);
|
2007-04-22 21:01:35 +00:00
|
|
|
}
|
2008-09-21 22:25:23 +00:00
|
|
|
else if (parent->ActorInfo == NULL)
|
2007-04-22 21:01:35 +00:00
|
|
|
{
|
2009-02-19 14:36:37 +00:00
|
|
|
sc.Message(MSG_ERROR, "uninitialized parent type '%s' in %s", parentName.GetChars(), typeName.GetChars());
|
|
|
|
parent = RUNTIME_CLASS(AActor);
|
2008-07-21 17:03:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-21 22:25:23 +00:00
|
|
|
if (native)
|
2008-07-21 17:03:30 +00:00
|
|
|
{
|
|
|
|
ti = (PClass*)PClass::FindClass(typeName);
|
|
|
|
if (ti == NULL)
|
|
|
|
{
|
2009-02-19 14:36:37 +00:00
|
|
|
sc.Message(MSG_ERROR, "Unknown native class '%s'", typeName.GetChars());
|
|
|
|
goto create;
|
2008-07-21 17:03:30 +00:00
|
|
|
}
|
2008-08-10 14:19:47 +00:00
|
|
|
else if (ti != RUNTIME_CLASS(AActor) && ti->ParentClass->NativeClass() != parent->NativeClass())
|
2008-07-21 17:03:30 +00:00
|
|
|
{
|
2009-02-19 14:36:37 +00:00
|
|
|
sc.Message(MSG_ERROR, "Native class '%s' does not inherit from '%s'", typeName.GetChars(), parentName.GetChars());
|
|
|
|
parent = RUNTIME_CLASS(AActor);
|
|
|
|
goto create;
|
2008-07-21 17:03:30 +00:00
|
|
|
}
|
|
|
|
else if (ti->ActorInfo != NULL)
|
|
|
|
{
|
2009-02-19 14:36:37 +00:00
|
|
|
sc.Message(MSG_ERROR, "Redefinition of internal class '%s'", typeName.GetChars());
|
|
|
|
goto create;
|
2008-07-21 17:03:30 +00:00
|
|
|
}
|
|
|
|
ti->InitializeActorInfo();
|
|
|
|
info = ti->ActorInfo;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-02-19 14:36:37 +00:00
|
|
|
create:
|
2008-07-21 17:03:30 +00:00
|
|
|
ti = parent->CreateDerivedClass (typeName, parent->Size);
|
|
|
|
info = ti->ActorInfo;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2007-05-28 22:18:51 +00:00
|
|
|
if (parent->ActorInfo->DamageFactors != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2007-05-28 22:18:51 +00:00
|
|
|
// copy damage factors from parent
|
|
|
|
info->DamageFactors = new DmgFactors;
|
|
|
|
*info->DamageFactors = *parent->ActorInfo->DamageFactors;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2007-05-28 22:18:51 +00:00
|
|
|
if (parent->ActorInfo->PainChances != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2007-05-28 22:18:51 +00:00
|
|
|
// copy pain chances from parent
|
|
|
|
info->PainChances = new PainChanceList;
|
|
|
|
*info->PainChances = *parent->ActorInfo->PainChances;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-12-07 12:11:59 +00:00
|
|
|
info->Replacee = info->Replacement = NULL;
|
|
|
|
info->DoomEdNum = -1;
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-12-07 12:11:59 +00:00
|
|
|
void SetReplacement(FActorInfo *info, FName replaceName)
|
|
|
|
{
|
|
|
|
// Check for "replaces"
|
|
|
|
if (replaceName != NAME_None)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-12-07 12:11:59 +00:00
|
|
|
// Get actor name
|
|
|
|
const PClass *replacee = PClass::FindClass (replaceName);
|
|
|
|
|
|
|
|
if (replacee == NULL)
|
|
|
|
{
|
|
|
|
I_Error ("Replaced type '%s' not found in %s", replaceName.GetChars(), info->Class->TypeName.GetChars());
|
|
|
|
}
|
|
|
|
else if (replacee->ActorInfo == NULL)
|
|
|
|
{
|
|
|
|
I_Error ("Replaced type '%s' is not an actor in %s", replaceName.GetChars(), info->Class->TypeName.GetChars());
|
|
|
|
}
|
|
|
|
if (replacee != NULL)
|
|
|
|
{
|
|
|
|
replacee->ActorInfo->Replacement = info;
|
|
|
|
info->Replacee = replacee->ActorInfo;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2006-10-31 14:53:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
2008-10-25 17:38:00 +00:00
|
|
|
// Finalizes an actor definition
|
2006-10-31 14:53:21 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-10-25 17:38:00 +00:00
|
|
|
void FinishActor(const FScriptPosition &sc, FActorInfo *info, Baggage &bag)
|
|
|
|
{
|
2008-12-29 23:03:38 +00:00
|
|
|
PClass *ti = info->Class;
|
|
|
|
AActor *defaults = (AActor*)ti->Defaults;
|
2006-12-16 12:50:36 +00:00
|
|
|
|
2008-09-21 22:25:23 +00:00
|
|
|
try
|
2006-03-12 22:04:49 +00:00
|
|
|
{
|
2008-12-07 12:11:59 +00:00
|
|
|
bag.statedef.FinishStates (info, defaults);
|
2006-10-31 14:53:21 +00:00
|
|
|
}
|
2008-09-21 22:25:23 +00:00
|
|
|
catch (CRecoverableError &err)
|
2006-12-16 12:50:36 +00:00
|
|
|
{
|
2008-12-29 23:03:38 +00:00
|
|
|
sc.Message(MSG_ERROR, "%s", err.GetMessage());
|
|
|
|
bag.statedef.MakeStateDefines(NULL);
|
|
|
|
return;
|
2006-12-16 12:50:36 +00:00
|
|
|
}
|
2008-10-25 17:38:00 +00:00
|
|
|
bag.statedef.InstallStates (info, defaults);
|
2008-12-07 12:11:59 +00:00
|
|
|
bag.statedef.MakeStateDefines(NULL);
|
2008-10-25 17:38:00 +00:00
|
|
|
if (bag.DropItemSet)
|
2008-09-21 22:25:23 +00:00
|
|
|
{
|
2008-10-25 17:38:00 +00:00
|
|
|
if (bag.DropItemList == NULL)
|
|
|
|
{
|
2008-12-29 23:03:38 +00:00
|
|
|
if (ti->Meta.GetMetaInt (ACMETA_DropItems) != 0)
|
2008-10-25 17:38:00 +00:00
|
|
|
{
|
2008-12-29 23:03:38 +00:00
|
|
|
ti->Meta.SetMetaInt (ACMETA_DropItems, 0);
|
2008-10-25 17:38:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2008-09-21 22:25:23 +00:00
|
|
|
{
|
2008-12-29 23:03:38 +00:00
|
|
|
ti->Meta.SetMetaInt (ACMETA_DropItems,
|
2008-10-25 17:38:00 +00:00
|
|
|
StoreDropItemChain(bag.DropItemList));
|
2008-09-21 22:25:23 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-29 23:03:38 +00:00
|
|
|
if (ti->IsDescendantOf (RUNTIME_CLASS(AInventory)))
|
2008-10-25 17:38:00 +00:00
|
|
|
{
|
|
|
|
defaults->flags |= MF_SPECIAL;
|
|
|
|
}
|
2008-02-16 10:23:12 +00:00
|
|
|
|
2008-12-29 23:03:38 +00:00
|
|
|
// Weapons must be checked for all relevant states. They may crash the game otherwise.
|
|
|
|
if (ti->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
|
2008-09-21 22:25:23 +00:00
|
|
|
{
|
2008-12-29 23:03:38 +00:00
|
|
|
FState * ready = ti->ActorInfo->FindState(NAME_Ready);
|
|
|
|
FState * select = ti->ActorInfo->FindState(NAME_Select);
|
|
|
|
FState * deselect = ti->ActorInfo->FindState(NAME_Deselect);
|
|
|
|
FState * fire = ti->ActorInfo->FindState(NAME_Fire);
|
|
|
|
|
|
|
|
// Consider any weapon without any valid state abstract and don't output a warning
|
|
|
|
// This is for creating base classes for weapon groups that only set up some properties.
|
|
|
|
if (ready || select || deselect || fire)
|
2008-09-21 22:25:23 +00:00
|
|
|
{
|
2008-12-29 23:03:38 +00:00
|
|
|
if (!ready)
|
|
|
|
{
|
|
|
|
sc.Message(MSG_ERROR, "Weapon %s doesn't define a ready state.\n", ti->TypeName.GetChars());
|
|
|
|
}
|
|
|
|
if (!select)
|
|
|
|
{
|
|
|
|
sc.Message(MSG_ERROR, "Weapon %s doesn't define a select state.\n", ti->TypeName.GetChars());
|
|
|
|
}
|
|
|
|
if (!deselect)
|
|
|
|
{
|
|
|
|
sc.Message(MSG_ERROR, "Weapon %s doesn't define a deselect state.\n", ti->TypeName.GetChars());
|
|
|
|
}
|
|
|
|
if (!fire)
|
|
|
|
{
|
|
|
|
sc.Message(MSG_ERROR, "Weapon %s doesn't define a fire state.\n", ti->TypeName.GetChars());
|
|
|
|
}
|
2008-09-21 22:25:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-29 23:03:38 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Do some postprocessing after everything has been defined
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-09-21 22:25:23 +00:00
|
|
|
|
2008-10-25 17:38:00 +00:00
|
|
|
static void FinishThingdef()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-12-29 23:03:38 +00:00
|
|
|
int errorcount = StateParams.ResolveAll();
|
2009-10-15 03:58:23 +00:00
|
|
|
unsigned i, j;
|
2008-10-25 17:38:00 +00:00
|
|
|
|
2009-10-15 21:23:59 +00:00
|
|
|
FILE *dump = fopen("disasm.txt", "w");
|
2009-10-15 03:58:23 +00:00
|
|
|
for (i = 0; i < StateTempCalls.Size(); ++i)
|
|
|
|
{
|
|
|
|
FStateTempCall *tcall = StateTempCalls[i];
|
|
|
|
FCompileContext ctx(tcall->ActorInfo->Class, true);
|
|
|
|
for (j = 0; j < tcall->Parameters.Size(); ++j)
|
|
|
|
{
|
|
|
|
tcall->Parameters[j]->Resolve(ctx);
|
|
|
|
}
|
|
|
|
VMFunctionBuilder buildit;
|
2009-10-15 23:11:54 +00:00
|
|
|
// Allocate registers used to pass parameters in.
|
|
|
|
// self, stateowner, state, statecalldata (all are pointers)
|
|
|
|
buildit.Registers[REGT_POINTER].Get(4);
|
|
|
|
// Emit code for action parameters.
|
2009-10-15 03:58:23 +00:00
|
|
|
for (j = 0; j < tcall->Parameters.Size(); ++j)
|
|
|
|
{
|
|
|
|
FxExpression *p = /*new FxParameter*/(tcall->Parameters[j]);
|
|
|
|
p->Emit(&buildit);
|
|
|
|
delete p;
|
|
|
|
}
|
|
|
|
// FIXME: Call a real function
|
|
|
|
buildit.Emit(OP_CALL_K, buildit.GetConstantAddress(NULL, ATAG_OBJECT), j, 0);
|
|
|
|
VMScriptFunction *func = buildit.MakeFunction();
|
|
|
|
#if 1
|
|
|
|
const char *marks = "=======================================================";
|
2009-10-15 22:15:55 +00:00
|
|
|
char label[64];
|
2009-10-15 03:58:23 +00:00
|
|
|
int labellen = mysnprintf(label, countof(label), "Function %s.States[%d] (*%d)",
|
|
|
|
tcall->ActorInfo->Class->TypeName.GetChars(),
|
|
|
|
tcall->FirstState, tcall->NumStates);
|
2009-10-15 21:23:59 +00:00
|
|
|
fprintf(dump, "\n%.*s %s %.*s", MAX(3, 38 - labellen / 2), marks, label, MAX(3, 38 - labellen / 2), marks);
|
2009-10-15 23:11:54 +00:00
|
|
|
fprintf(dump, "\nInteger regs: %-3d Float regs: %-3d Address regs: %-3d String regs: %-3d\nStack size: %d\n",
|
|
|
|
func->NumRegD, func->NumRegF, func->NumRegA, func->NumRegS, func->MaxParam);
|
2009-10-15 21:23:59 +00:00
|
|
|
VMDumpConstants(dump, func);
|
|
|
|
fprintf(dump, "\nDisassembly:\n");
|
2009-10-17 00:33:23 +00:00
|
|
|
VMDisasm(dump, func->Code, func->CodeSize, func);
|
2009-10-15 03:58:23 +00:00
|
|
|
#endif
|
|
|
|
//if(i==6) I_Error("Poop");
|
|
|
|
}
|
2009-10-15 21:23:59 +00:00
|
|
|
fclose(dump);
|
2009-10-15 03:58:23 +00:00
|
|
|
I_Error("Poop");
|
|
|
|
|
|
|
|
for (i = 0; i < PClass::m_Types.Size(); i++)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-06-17 20:29:41 +00:00
|
|
|
PClass * ti = PClass::m_Types[i];
|
|
|
|
|
|
|
|
// Skip non-actors
|
|
|
|
if (!ti->IsDescendantOf(RUNTIME_CLASS(AActor))) continue;
|
|
|
|
|
2009-01-28 05:29:41 +00:00
|
|
|
if (ti->Size == (unsigned)-1)
|
2008-08-09 11:35:42 +00:00
|
|
|
{
|
2008-12-29 23:03:38 +00:00
|
|
|
Printf("Class %s referenced but not defined\n", ti->TypeName.GetChars());
|
2008-08-09 11:35:42 +00:00
|
|
|
errorcount++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2008-12-29 23:03:38 +00:00
|
|
|
AActor *def = GetDefaultByType(ti);
|
2008-03-01 13:12:33 +00:00
|
|
|
|
2008-12-29 23:03:38 +00:00
|
|
|
if (!def)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-12-29 23:03:38 +00:00
|
|
|
Printf("No ActorInfo defined for class '%s'\n", ti->TypeName.GetChars());
|
|
|
|
errorcount++;
|
|
|
|
continue;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
2008-02-16 10:23:12 +00:00
|
|
|
if (errorcount > 0)
|
|
|
|
{
|
|
|
|
I_Error("%d errors during actor postprocessing", errorcount);
|
|
|
|
}
|
2006-05-07 00:27:22 +00:00
|
|
|
|
|
|
|
// Since these are defined in DECORATE now the table has to be initialized here.
|
|
|
|
for(int i=0;i<31;i++)
|
|
|
|
{
|
|
|
|
char fmt[20];
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
mysnprintf(fmt, countof(fmt), "QuestItem%d", i+1);
|
|
|
|
QuestItemClasses[i] = PClass::FindClass(fmt);
|
2006-05-07 00:27:22 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2006-12-04 23:25:59 +00:00
|
|
|
|
2008-10-25 17:38:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// LoadActors
|
|
|
|
//
|
|
|
|
// Called from FActor::StaticInit()
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void LoadActors ()
|
|
|
|
{
|
|
|
|
int lastlump, lump;
|
|
|
|
|
2008-12-29 23:03:38 +00:00
|
|
|
FScriptPosition::ResetErrorCounter();
|
2008-10-25 17:38:00 +00:00
|
|
|
InitThingdef();
|
|
|
|
lastlump = 0;
|
|
|
|
while ((lump = Wads.FindLump ("DECORATE", &lastlump)) != -1)
|
|
|
|
{
|
|
|
|
FScanner sc(lump);
|
|
|
|
ParseDecorate (sc);
|
|
|
|
}
|
2008-12-29 23:03:38 +00:00
|
|
|
if (FScriptPosition::ErrorCounter > 0)
|
|
|
|
{
|
|
|
|
I_Error("%d errors while parsing DECORATE scripts", FScriptPosition::ErrorCounter);
|
|
|
|
}
|
2008-10-25 17:38:00 +00:00
|
|
|
FinishThingdef();
|
|
|
|
}
|
|
|
|
|