Removed a lot of tool code.

This commit is contained in:
Steven Fuller 2008-05-04 20:47:08 -07:00 committed by Patryk Obara
parent 9b449609fa
commit 5d3725f9d9
41 changed files with 19 additions and 2062 deletions

View file

@ -7,7 +7,7 @@ CFLAGS = -m32 -g -Wall -pipe -O2
CFLAGS += -DLINUX
CFLAGS += -Dengine=1 -Isrc -Isrc/include -Isrc/win95 -Isrc/avp -Isrc/avp/win95 -Isrc/avp/support -Isrc/avp/win95/frontend -Isrc/avp/win95/gadgets
CFLAGS += -Isrc -Isrc/include -Isrc/win95 -Isrc/avp -Isrc/avp/win95 -Isrc/avp/support -Isrc/avp/win95/frontend -Isrc/avp/win95/gadgets
CFLAGS += $(shell sdl-config --cflags) $(shell openal-config --cflags)
CXXFLAGS = $(CFLAGS)

View file

@ -3,10 +3,6 @@
//#include "strachnk.hpp"
//#include "obchunk.hpp"
#ifdef cencon
#define new my_new
#endif
//macro for helping to force inclusion of chunks when using libraries
FORCE_CHUNK_INCLUDE_IMPLEMENT(avpchunk)
@ -110,19 +106,7 @@ ObjectID AVP_Generator_Chunk::CalculateID()
if(!chlist.size()) return retval;
char Name[100];
#if InterfaceEngine||cencon
//need to check for console specific rif files,and skip the 'sat' or 'psx'
//so that they get the same ids as the pc
const char* r_name=((RIF_Name_Chunk*)chlist.first_entry())->rif_name;
if(tolower(r_name[0])=='p' && tolower(r_name[1])=='s' && tolower(r_name[2])=='x' )
strcpy(Name,&r_name[3]);
else if (tolower(r_name[0])=='s' && tolower(r_name[1])=='a' && tolower(r_name[2])=='t' )
strcpy(Name,&r_name[3]);
else
strcpy(Name,r_name);
#else
strcpy(Name,((RIF_Name_Chunk*)chlist.first_entry())->rif_name);
#endif
strcat(Name,name);
char buffer[16];

View file

@ -561,46 +561,6 @@ void SimpleStrategy::set_r6_destruction_type(unsigned int dest_type)
}
//////////////////////////////////////////////
#if InterfaceEngine
R6SimpleStrategy::R6SimpleStrategy(int _Type, int _ExtraData, int _mass, int _integrity)
:SimpleStrategy(_Type,_ExtraData,_mass,_integrity)
{
StrategyType = StratR6SimpleObject;
r6SoundID.id1 = 0;
r6SoundID.id2 = 0;
r6_spare1 = 0;
r6_spare2 = 0;
r6_spare3 = 0;
r6_spare4 = 0;
r6_spare5 = 0;
r6_spare6 = 0;
}
R6SimpleStrategy::R6SimpleStrategy(SimpleStrategy* ss)
:SimpleStrategy(0,0,0,0)
{
StrategyType = StratR6SimpleObject;
Type = ss->Type;
ExtraData = ss->ExtraData;
mass = ss->mass;
integrity = ss->integrity;
flags = ss->flags;
target_request = ss->target_request;
targetID = ss->targetID;
r6SoundID.id1 = 0;
r6SoundID.id2 = 0;
r6_spare1 = 0;
r6_spare2 = 0;
r6_spare3 = 0;
r6_spare4 = 0;
r6_spare5 = 0;
r6_spare6 = 0;
}
#endif
R6SimpleStrategy::R6SimpleStrategy(const char * data,size_t size)
:SimpleStrategy(data,size)

View file

@ -68,10 +68,6 @@ class AVP_Strategy_Chunk :public Chunk
AvpStrat* Strategy;
};
#if InterfaceEngine
class StrategyObject;
#endif
class AVP_External_Strategy_Chunk :public Chunk
{
public:
@ -138,17 +134,6 @@ class AvpStrat
int Type,ExtraData;
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
StrategyObject* SObject;
AvpStrat(int type,StrategyObject* dptr);
virtual int CopyStrategy(AVP_Strategy_Chunk*,StrategyObject*);//copy strategy to the chunk
virtual BOOL CanCopyStrategy(){return 0;};
virtual int EditStrategy(int Edit);//if Edit=0 only view it
virtual int VerifyStrategy(){return 1;};
virtual void _EditSwitchRequest(int& request);
virtual void RemoveInvalidTargets(){};
#endif
};
class MiscStrategy :public AvpStrat
@ -162,10 +147,6 @@ class MiscStrategy :public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
virtual int EditStrategy(int Edit);
#endif
};
@ -216,26 +197,6 @@ public:
void set_r6_integrity(unsigned int);
unsigned int get_r6_destruction_type();
void set_r6_destruction_type(unsigned int);
#if InterfaceEngine
SimpleStrategy (int _Type, int _ExtraData, int _mass, int _integrity)
: AvpStrat (StratNewSimpleObject,0), Type(_Type), ExtraData(_ExtraData),
mass (_mass), integrity (_integrity)
{
flags=SimStratFlag_NotifyTargetOnDestruction;
target_request=0;
targetID.id1=targetID.id2=0;
integrity|=SimpleStrategy_SparesDontContainJunk;
}
SimpleStrategy(StrategyObject*);
virtual int EditStrategy(int Edit);
virtual BOOL CanCopyStrategy(){return 1;};
virtual int CopyStrategy(AVP_Strategy_Chunk*,StrategyObject*);
void EditTarget();
virtual void _EditSwitchRequest(int& request);
virtual void RemoveInvalidTargets();
#endif
};
class R6SimpleStrategy : public SimpleStrategy
@ -254,11 +215,6 @@ public :
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
R6SimpleStrategy (int _Type, int _ExtraData, int _mass, int _integrity);
R6SimpleStrategy (SimpleStrategy* ss);
#endif
};
@ -295,26 +251,6 @@ class LiftStrategy :public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
const char* GetStartName();
void GetStartPos(int& FileNum,ObjectID& StartID);
LiftStrategy(StrategyObject* dptr);
LiftStrategy(LiftStrategy* ls);
virtual int EditStrategy(int Edit);
virtual int VerifyStrategy();
void EditAssocLifts(int Edit);
void EditAssocDoor(int Edit);
void EditAssocCallSwitch(int Edit);
void EditAssocFloorSwitch(int Edit);
void CalculateFloor(int FileNum,ObjectID liftid);
int EditExternalLifts(int FileNum,int Edit,int sel);
void AlterOtherPos();
void GetFloorSwitch(File_Chunk* fc,ObjectID LiftID);
#endif
};
#define PlatformLiftFlags_Disabled 0x00000001
@ -329,15 +265,6 @@ class PlatLiftStrategy :public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
PlatLiftStrategy(StrategyObject* dptr);
virtual int EditStrategy(int Edit);
virtual int VerifyStrategy();
#endif
};
#define DoorFlag_Locked 0x00000001
@ -358,14 +285,6 @@ class DoorStrategy :public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
DoorStrategy(StrategyObject*);
virtual int CopyStrategy(AVP_Strategy_Chunk*,StrategyObject*);
BOOL CanCopyStrategy(){return 1;};
virtual int VerifyStrategy();
virtual int EditStrategy(int Edit);
#endif
};
#define R6SwitchDoorFlag_SwitchOperated 0x00000001
@ -392,14 +311,6 @@ class SwitchDoorStrategy : public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
SwitchDoorStrategy(StrategyObject*);
virtual int VerifyStrategy();
virtual int EditStrategy(int Edit);
void EditAssocDoor(int Edit);
#endif
};
struct SwitchTarget
@ -426,17 +337,6 @@ class BinSwitchStrategy :public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
BinSwitchStrategy(StrategyObject*);
BinSwitchStrategy(StrategyObject*,BinSwitchStrategy*);
virtual int CopyStrategy(AVP_Strategy_Chunk*,StrategyObject*);
BOOL CanCopyStrategy(){return 1;};
virtual int EditStrategy(int Edit);
virtual int VerifyStrategy();
int EditTarget(int Edit);
virtual void RemoveInvalidTargets();
#endif
};
class LinkSwitchStrategy :public BinSwitchStrategy
@ -450,14 +350,8 @@ class LinkSwitchStrategy :public BinSwitchStrategy
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
LinkSwitchStrategy(StrategyObject*);
virtual int EditStrategy(int Edit);
virtual int VerifyStrategy();
#endif
};
#define MultiSwitchFlag_SwitchUpdated 0x80000000
#define MultiSwitchFlag_OffMessageSame 0x00000002
#define MultiSwitchFlag_OffMessageNone 0x00000004
@ -485,22 +379,6 @@ class MultiSwitchStrategy :public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
MultiSwitchStrategy(StrategyObject*);
MultiSwitchStrategy(StrategyObject*,MultiSwitchStrategy*);
virtual int CopyStrategy(AVP_Strategy_Chunk*,StrategyObject*);
BOOL CanCopyStrategy(){return 1;};
virtual int EditStrategy(int Edit);
virtual int VerifyStrategy();
void EditTargets(int Edit,int envnum);
void add_target(ObjectID targetid,int envnum);
void duplicate_target(int index);
void remove_target(int index);
virtual void _EditSwitchRequest(int& request);
virtual void RemoveInvalidTargets();
#endif
};
class AreaSwitchStrategy :public MultiSwitchStrategy
@ -513,15 +391,6 @@ class AreaSwitchStrategy :public MultiSwitchStrategy
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
AreaSwitchStrategy(StrategyObject*);
AreaSwitchStrategy(StrategyObject*,AreaSwitchStrategy*);
virtual int CopyStrategy(AVP_Strategy_Chunk*,StrategyObject*);
BOOL CanCopyStrategy(){return 1;};
void EditTriggerVolume();
#endif
};
@ -536,12 +405,6 @@ class ConsoleStrategy :public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
ConsoleStrategy(StrategyObject*);
virtual int EditStrategy(int Edit);
// virtual int VerifyStrategy();
#endif
};
class LightingStrategy : public AvpStrat
@ -555,15 +418,6 @@ class LightingStrategy : public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
LightingStrategy(StrategyObject*);
LightingStrategy(LightingStrategy*,StrategyObject*);
virtual int CopyStrategy(AVP_Strategy_Chunk*,StrategyObject*);
BOOL CanCopyStrategy(){return 1;};
virtual int EditStrategy(int Edit);
#endif
};
#define Teleport_All 0
@ -582,14 +436,6 @@ class TeleportStrategy : public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
TeleportStrategy(StrategyObject*);
virtual int VerifyStrategy();
virtual int EditStrategy(int Edit);
void EditTeleportTo(int Edit);
#endif
};
@ -608,16 +454,6 @@ class EnemyStrategy : public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
EnemyStrategy(StrategyObject*);
EnemyStrategy(StrategyObject*,EnemyStrategy*);
virtual int EditStrategy(int Edit);
virtual int CopyStrategy(AVP_Strategy_Chunk*,StrategyObject*);
int EditTarget(int Edit);
virtual void RemoveInvalidTargets();
#endif
};
class GeneratorStrategy : public AvpStrat
@ -633,12 +469,6 @@ class GeneratorStrategy : public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
GeneratorStrategy(StrategyObject*);
virtual int EditStrategy(int Edit);
#endif
};
@ -692,14 +522,6 @@ class MissionObjectiveStrategy : public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
MissionObjectiveStrategy(StrategyObject*);
virtual int EditStrategy(int Edit);
void EditMissionTargets();
virtual void _EditSwitchRequest(int& request);
virtual void RemoveInvalidTargets();
#endif
};
class MissionHintStrategy : public AvpStrat
@ -715,10 +537,6 @@ class MissionHintStrategy : public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
MissionHintStrategy(StrategyObject*);
virtual int EditStrategy(int Edit);
#endif
};
#define TextMessageFlag_NotActiveAtStart 0x00000001
@ -734,11 +552,6 @@ class TextMessageStrategy : public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
TextMessageStrategy(StrategyObject*);
virtual int EditStrategy(int Edit);
virtual void _EditSwitchRequest(int& request);
#endif
};
@ -782,14 +595,6 @@ class TrackStrategy : public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
TrackStrategy(StrategyObject*);
int EditStrategy(int Edit);
void EditTargets(TrackPointEffect*);
void _EditSwitchRequest(int& request);
virtual void RemoveInvalidTargets();
#endif
};
class TrackDestructStrategy : public TrackStrategy
@ -803,12 +608,6 @@ class TrackDestructStrategy : public TrackStrategy
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
TrackDestructStrategy(StrategyObject*);
virtual void RemoveInvalidTargets();
void EditTarget();
#endif
};
class HierarchyStrategy : public AvpStrat
@ -825,12 +624,6 @@ class HierarchyStrategy : public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
HierarchyStrategy(StrategyObject*);
int EditStrategy(int Edit);
void EditTargets(TrackPointEffect*);
virtual void RemoveInvalidTargets();
#endif
};
class FanStrategy : public AvpStrat
@ -845,10 +638,6 @@ class FanStrategy : public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
FanStrategy(StrategyObject*);
int EditStrategy(int Edit);
#endif
};
#define DeathVolumeFlag_StartsOn 0x00000001
@ -866,10 +655,6 @@ class DeathVolumeStrategy : public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
DeathVolumeStrategy(StrategyObject*);
int EditStrategy(int Edit);
#endif
};
class SelfDestructStrategy : public AvpStrat
@ -882,10 +667,6 @@ class SelfDestructStrategy : public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
SelfDestructStrategy(StrategyObject*);
int EditStrategy(int Edit);
#endif
};
@ -914,12 +695,6 @@ class SwingDoorStrategy : public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
SwingDoorStrategy(StrategyObject*);
int EditStrategy(int Edit);
void EditPairedDoor();
void EditDoorwayModule();
#endif
};
@ -953,10 +728,6 @@ class PlacedBombStrategy : public AvpStrat
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
PlacedBombStrategy(StrategyObject*);
int EditStrategy(int Edit);
#endif
};
class R6SwitchStrategy : public AvpStrat
@ -970,14 +741,7 @@ class R6SwitchStrategy : public AvpStrat
int spare1,spare2,spare3,spare4;
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
R6SwitchStrategy(StrategyObject*);
int EditStrategy(int Edit);
void EditTarget();
virtual void RemoveInvalidTargets();
#endif
virtual void fill_data_block(char* data);
};
/////////////////////Mummy strategy alert/////////////////////////
@ -997,16 +761,7 @@ public :
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
MummyInanimateStrategy(StrategyObject*);
int EditStrategy(int Edit);
virtual void RemoveInvalidTargets();
void EditTarget();
void EditLinkedSound();
#endif
virtual void fill_data_block(char* data);
};
@ -1021,14 +776,7 @@ public :
int spare1,spare2,spare3,spare4;
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
// MummyPickupStrategy(StrategyObject*);
int EditStrategy(int Edit){return 0;};
// virtual void RemoveInvalidTargets();
#endif
virtual void fill_data_block(char* data);
};
class MummyTriggerVolumeStrategy : public AvpStrat
@ -1043,15 +791,6 @@ public :
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
MummyTriggerVolumeStrategy(StrategyObject*);
int EditStrategy(int Edit);
void EditTriggerVolume();
void EditTarget();
virtual void RemoveInvalidTargets();
#endif
};
#define MummyPivotObject_Pillar 0
@ -1072,15 +811,6 @@ public :
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
MummyPivotObjectStrategy(StrategyObject*);
int EditStrategy(int Edit);
void EditTarget();
virtual void RemoveInvalidTargets();
void EditTriggerVolume();
#endif
};
class MummyChestStrategy : public AvpStrat
@ -1095,14 +825,6 @@ public :
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
MummyChestStrategy(StrategyObject*);
int EditStrategy(int Edit);
void EditObjective(int index);
void EditCameraLocation();
#endif
};
@ -1127,16 +849,6 @@ public :
virtual size_t GetStrategySize();
virtual void fill_data_block(char* data);
#if InterfaceEngine
MummyAlterCameraRangeStrategy(StrategyObject*);
int EditStrategy(int Edit);
void EditTriggerVolume();
#endif
};
#endif

View file

@ -31,8 +31,6 @@ extern "C" {
#define SuppressWarnings Yes
#define InterfaceEngine No
#define Term -1

View file

@ -165,15 +165,6 @@ typedef struct modulemapblock {
int MapInteriorType;
#if InterfaceEngine
/* This will point to the Object_Chunk, it will have to be */
/* cast within C++ though */
void * o_chunk;
#endif
int MapLightType; /* See LIGHTTYPES */

View file

@ -347,15 +347,6 @@ typedef struct mapblock6 {
int MapInteriorType;
#if InterfaceEngine
/* This will point to the Object_Chunk, it will have to be */
/* cast within C++ though */
void * o_chunk;
#endif
} MAPBLOCK6;
@ -385,15 +376,6 @@ typedef struct mapblock7 {
int MapInteriorType;
#if InterfaceEngine
/* This will point to the Object_Chunk, it will have to be */
/* cast within C++ though */
void * o_chunk;
#endif
int MapLightType; /* See LIGHTTYPES */

View file

@ -475,25 +475,6 @@ typedef struct polyheader {
} POLYHEADER;
#if InterfaceEngine
/*
Little structure for use creating
merge lists
*/
typedef struct merged_poly
{
int other_poly;
int num_verts;
int vert_ind[4];
} MERGED_POLY;
#endif
/*
@ -518,15 +499,7 @@ typedef struct merged_poly
#define iflag_no_bfc 0x00000020 /* No Back Face Cull */
#define iflag_hazing 0x00000040 /* Haze / Depth Cue colour */
#if InterfaceEngine
#define iflag_selected 0x00000080 /* It's a tools thing */
#else
#define iflag_zbuffer_w 0x00000080 /* Z-Buffer, Write-Only */
#endif /* InterfaceEngine */
#define iflag_zbuffer_w 0x00000080 /* Z-Buffer, Write-Only */
#define iflag_shadingtable 0x00000100 /* Hue is a table index */
#define iflag_tab_gour_8 0x00000200 /* Gour. for 8-bit modes uses tab. */

View file

@ -395,10 +395,6 @@ void AllocateModuleObject(MODULE *mptr)
#endif /* Support Morphing */
#if InterfaceEngine
dbptr->o_chunk = mapblockptr->o_chunk;
#endif
dptr->ObLightType = LightType_PerVertex;
dptr->ObFlags |= ObFlag_MultLSrc;

View file

@ -30,9 +30,6 @@ struct FrameList
{
~FrameList();
FrameList(TEXANIM*);
#if InterfaceEngine
FrameList(TEXANIM* p,FrameList* templ);
#endif
FrameList(TEXANIM* p,FrameList* fl,int* conv);
int Speed;
int Flags;
@ -44,14 +41,6 @@ struct FrameList
int* Textures;
int* UVCoords;
int spare1,spare2;
#if InterfaceEngine
void CopyToSID(int shape,int poly);
void CopyFromSID(int shape,int poly);
void AddFrame();
void RemoveFrame();
#endif
};
#define AnimFlag_NotPlaying 0x00000001
@ -61,11 +50,6 @@ struct TEXANIM
TEXANIM();
~TEXANIM();
#if InterfaceEngine
TEXANIM(int s,int p,int id);
//construct a TEXANIM using templ as a template.
TEXANIM(int s,int p,TEXANIM* templ);
#endif
int shape;
int poly;
int NumVerts;
@ -76,12 +60,6 @@ struct TEXANIM
int Identifier;
FrameList** Seq;
#if InterfaceEngine
void ChangeFrame(int newseq,int newframe);
void AddSeq();
void RemoveSeq();
void CopySeq(int seq_num);
#endif
void CopyAnimData(TEXANIM* ta,int* conv);
};

View file

@ -2,21 +2,9 @@
#include "bmpnames.hpp"
#include "mishchnk.hpp"
#if engine
#define UseLocalAssert No
#include "ourasert.h"
#define assert(x) GLOBALASSERT(x)
#else
#if cencon
#include "ccassert.h"
#else
#include <assert.h>
#endif
#endif
#ifdef cencon
#define new my_new
#endif
//macro for helping to force inclusion of chunks when using libraries
FORCE_CHUNK_INCLUDE_IMPLEMENT(bmpnames)
@ -24,9 +12,6 @@ FORCE_CHUNK_INCLUDE_IMPLEMENT(bmpnames)
BMP_Name::BMP_Name (const char * fname, int const gbnc_version)
: flags((BMPN_Flags)DEFAULT_BMPN_FLAGS), index(0), version_num (gbnc_version << BMPNAME_PARENT_VER_SHIFT), enum_id(0), priority (DEFAULT_BMPN_PRIORITY), transparency_colour_union(0)
#if cencon
, md5val(0)
#endif
{
filename = new char [strlen(fname)+1];
strcpy (filename, fname);
@ -34,9 +19,6 @@ BMP_Name::BMP_Name (const char * fname, int const gbnc_version)
BMP_Name::BMP_Name (const char * fname)
: flags((BMPN_Flags)DEFAULT_BMPN_FLAGS), index(0), version_num (0), enum_id(0), priority (DEFAULT_BMPN_PRIORITY), transparency_colour_union(0)
#if cencon
, md5val(0)
#endif
{
filename = new char [strlen(fname)+1];
strcpy (filename, fname);
@ -60,9 +42,6 @@ BMP_Name::BMP_Name (const BMP_Name & bn)
enum_id = bn.enum_id;
priority = bn.priority;
transparency_colour_union = bn.transparency_colour_union;
#if cencon
md5val = bn.md5val;
#endif
}
void BMP_Name::Validate(void)
@ -88,13 +67,8 @@ const BMP_Name & BMP_Name::operator=(const BMP_Name & bn)
enum_id = bn.enum_id;
priority = bn.priority;
transparency_colour_union = bn.transparency_colour_union;
#if cencon
md5val = bn.md5val;
#endif
return(*this);
}

View file

@ -4,22 +4,10 @@
#include "chunk.hpp"
// for assert
#if engine
#define UseLocalAssert No
#include "ourasert.h"
#define assert(x) GLOBALASSERT(x)
#else
#if cencon
#include "ccassert.h"
#else
#include <assert.h>
#endif
#endif
enum BMPN_Flags
{
ChunkBMPFlag_Null = 0x00000000, // all flags reset
@ -165,24 +153,6 @@ public:
void Validate(void);
#if cencon
int const * md5val; // space to put a pointer
void DeleteAssociatedFiles() const;
void DeleteAssociatedMipFiles() const;
// changes the filename member, returns FALSE on failure
BOOL Rename(char const * newname);
// use these to prevent DeleteAssociatedMipFiles & DeleteAssociatedFiles
// from deleting specific files
static void PreventDeleteFile(char const * pszFileName);
static void ReallowDeleteFile(char const * pszFileName);
private:
static List<char *> ms_listFilesCantDelete;
static void DeleteFileProt(char const * pszFileName);
public:
#endif
unsigned GetTranspRedVal() const;
unsigned GetTranspGreenVal() const;
unsigned GetTranspBlueVal() const;
@ -346,8 +316,8 @@ public:
virtual void SetMD5Val(BMP_Name const & rcbmp, int const * md5id);
virtual void RemoveMD5Val(char const * bname);
friend class BMP_Group; // for cencon
friend class BMP_Info; // for cencon
//friend class BMP_Group; // for cencon
//friend class BMP_Info; // for cencon
protected:
virtual Bitmap_MD5_Chunk * GetMD5Chunk(char const * bname) = 0;

View file

@ -2999,10 +2999,6 @@ BOOL copy_to_map6(Object_Chunk * ob,MAPBLOCK6* mapblock, int shplst_pos)
mapblock->MapEuler.EulerY = e.EulerY;
mapblock->MapEuler.EulerZ = e.EulerZ;
#if InterfaceEngine
mapblock->o_chunk = (void *)ob;
#endif
return TRUE;
}

View file

@ -189,12 +189,7 @@ extern int start_of_loaded_shapes;
extern unsigned char *TextureLightingTable;
#if defined(InterfaceEngine) && InterfaceEngine
// this is of crucial importance!!
extern SHAPEHEADER * mainshapelist[];
#else
extern SHAPEHEADER ** mainshapelist;
#endif
extern MAPHEADER Map[];

View file

@ -2,26 +2,10 @@
#include <math.h>
#include "chnktype.hpp"
#if engine
#define UseLocalAssert No
#include "ourasert.h"
#define assert(x) GLOBALASSERT(x)
#else
#if cencon
#include "ccassert.h"
#else
#include <assert.h>
#endif
#endif
#ifdef cencon
#define new my_new
#endif
// misc data structures functions
BOOL operator==(const obinfile &o1, const obinfile &o2)
{
@ -175,7 +159,6 @@ ChunkVector& ChunkVector::operator-=(const ChunkVector& a)
#if engine
ChunkVector::operator VECTORCH () const
{
VECTORCH v;
@ -185,7 +168,7 @@ ChunkVector::operator VECTORCH () const
return(v);
}
#endif
ChunkVector::operator ChunkVectorInt () const
{
ChunkVectorInt v;
@ -267,7 +250,6 @@ ChunkVectorInt operator+(const ChunkVectorInt& a, const ChunkVectorInt& b)
return v;
}
ChunkVectorInt operator-(const ChunkVectorInt& a, const ChunkVectorInt& b)
{
ChunkVectorInt v;
@ -286,8 +268,6 @@ ChunkVectorInt& ChunkVectorInt::operator+=(const ChunkVectorInt& a)
return *this;
}
ChunkVectorInt& ChunkVectorInt::operator-=(const ChunkVectorInt& a)
{
x -= a.x;
@ -297,9 +277,6 @@ ChunkVectorInt& ChunkVectorInt::operator-=(const ChunkVectorInt& a)
return *this;
}
#if engine
ChunkVectorInt::operator VECTORCH () const
{
VECTORCH v;
@ -309,7 +286,6 @@ ChunkVectorInt::operator VECTORCH () const
return(v);
}
#endif
ChunkVectorInt operator*(const ChunkVectorInt & a, const double s)
{
@ -407,7 +383,6 @@ ChunkVectorFloat operator/(const ChunkVectorFloat & a, const double s)
return(v);
}
#if engine
ChunkVectorFloat::operator VECTORCH () const
{
VECTORCH v;
@ -417,7 +392,7 @@ ChunkVectorFloat::operator VECTORCH () const
return(v);
}
#endif
int ChunkVectorFloat::norm()
{
float modulos =(float) mod(*this);
@ -430,6 +405,7 @@ int ChunkVectorFloat::norm()
return(1);
}
double mod(const ChunkVectorFloat& a)
{
return(sqrt((double)a.x*(double)a.x+(double)a.y*(double)a.y+(double)a.z*(double)a.z));

View file

@ -1,9 +1,7 @@
#ifndef _chnktype_hpp
#define _chnktype_hpp 1
#if engine
#include "3dc.h"
#endif
#include "list_tem.hpp"
struct ChunkVectorInt;
@ -28,10 +26,7 @@ struct ChunkVector
ChunkVector friend operator*(const ChunkVector&, const ChunkVector&); //cross prod
#if engine
operator VECTORCH () const;
#endif
operator ChunkVectorInt () const;
operator ChunkVectorFloat () const;
@ -57,12 +52,8 @@ struct ChunkVectorInt
ChunkVectorInt friend operator/(const ChunkVectorInt&, const double);
//ChunkVectorInt friend operator*(const ChunkVectorInt&, const ChunkVectorInt&); //cross prod
#if engine
operator VECTORCH () const;
#endif
//friend double dot(const ChunkVector&, const ChunkVector&);//dot product
friend double mod(const ChunkVectorInt&);//magnitude of vector
@ -84,9 +75,8 @@ struct ChunkVectorFloat
ChunkVectorFloat friend operator/(const ChunkVectorFloat&, const double);
//ChunkVectorInt friend operator*(const ChunkVectorInt&, const ChunkVectorInt&); //cross prod
#if engine
operator VECTORCH () const;
#endif
//friend double dot(const ChunkVector&, const ChunkVector&);//dot product
friend double mod(const ChunkVectorFloat&);//magnitude of vector

View file

@ -2,34 +2,13 @@
#include "chunk.hpp"
#if engine
#define UseLocalAssert No
#include "ourasert.h"
#define assert(x) GLOBALASSERT(x)
#else
#if cencon
#include "ccassert.h"
#else
#include <assert.h>
#endif
#endif
#if cencon
#include "environs.hpp"
#else
#define twprintf printf
#ifdef cencon
#define new my_new
#endif
char * users_name = "Player";
#endif
#include "hash_tem.hpp"
Chunk * Parent_File;

View file

@ -5,57 +5,21 @@
#include "fixer.h"
#if engine
#include "3dc.h"
#include "mem3dc.h" // for debug new and delete
#include "3dc.h"
#include "mem3dc.h" // for debug new and delete
#include "inline.h"
#include "inline.h"
#if SupportModules
#include "module.h"
#include "module.h"
#endif
#include "list_tem.hpp"
#include "list_tem.hpp"
#endif
#if cencon
#include "AFXWIN.H"
#ifdef _DEBUG
#undef new
#define new DEBUG_NEW
#define my_new DEBUG_NEW
#else
#define my_new new
#endif
#include "list_tem.hpp"
#endif
#if objedit || sprite_edit || ANIMEXP
#include "StdAfx.h"
#include "list_tem.hpp"
#endif
#if shpedit
#include "stdafx.h"
#include "list_tem.hpp"
#endif
#if standard
#include "advwin32.h"
#include <windows.h>
#include "list_tem.hpp"
#endif
#define CHUNK_FAILED_ON_LOAD -1
#define CHUNK_FAILED_ON_LOAD_NOT_RECOGNISED -2
@ -75,10 +39,6 @@
// we start at the header of the chunk we are in
// so that we can stop at the end of the chunk
#if cencon
extern char users_name[];
#endif
#include "list_tem.hpp"
#ifndef RIFF_OPTIMIZE // define this to get compiler errors where you are calling the old slow functions
@ -655,36 +615,3 @@ FORCE_CHUNK_INCLUDE_END
*/
#endif // !included

View file

@ -1,23 +1,12 @@
#include "chunkpal.hpp"
#include "mishchnk.hpp"
#if engine
#ifndef UseLocalAssert
#define UseLocalAssert 1
#endif
#include "ourasert.h"
#define assert(x) GLOBALASSERT(x)
#else
#if cencon
#include "ccassert.h"
#else
#include <assert.h>
#endif
#endif
//macro for helping to force inclusion of chunks when using libraries
FORCE_CHUNK_INCLUDE_IMPLEMENT(chunkpal)

View file

@ -3,9 +3,6 @@
#include "chunk.hpp"
#include "bmpnames.hpp"
#if cencon
#include "palette.h"
#endif
class Environment_Data_Chunk;
@ -30,10 +27,6 @@ class Environment_Palette_Chunk : public Chunk
public:
#if cencon
// constructor from data - defined in genpal
Environment_Palette_Chunk (Chunk_With_Children * const parent, PPM_Header const * const palette);
#endif
// constructor from buffer
Environment_Palette_Chunk (Chunk_With_Children * const parent, const char * sdata, size_t const /*ssize*/)
: Chunk (parent, "ENVPALET")
@ -75,32 +68,6 @@ class Preset_Palette
{
public:
#if cencon
// constructor from data - defined in genpal
Preset_Palette (PPM_Header const * const palette);
// update by generating from bmps chunk
void update(Global_BMP_Name_Chunk * gbnc, Preset_Palette_Chunk * ppc, class Environment * e, Environment_Data_Chunk * envd, BOOL bDoSoftwareTex);
#if 0
Preset_Palette (const char * iname)
: size(0)
, flags(0)
, reserved1(0)
, reserved2(0)
, startpos(0)
, pixel_data(0)
, name(0)
{
if (iname)
{
name = new char[strlen(iname)+1];
strcpy(name,iname);
}
}
#endif
#endif
Preset_Palette ()
: size(0)
, flags(0)
@ -166,18 +133,6 @@ class Preset_Palette_Chunk : public Chunk
{
public:
#if cencon
// empty constructor
Preset_Palette_Chunk (Chunk_With_Children * const parent)
: Chunk (parent,"PRSETPAL")
, flags(0)
, version_num(0)
, reserved1(0)
, reserved2(0)
, reserved3(0)
{}
#endif
// constructor from buffer
Preset_Palette_Chunk (Chunk_With_Children * const parent, char const * sdata, size_t const ssize);
~Preset_Palette_Chunk () {};
@ -211,10 +166,6 @@ class Environment_TLT_Chunk : public Chunk
public:
#if cencon
// constructor using palette - defined in genpal
Environment_TLT_Chunk (Chunk_With_Children * parent, PPM_Header * palette, PPM_Header * tlt_palette, Lighting_Style const * ls);
#endif
// constructor from buffer
Environment_TLT_Chunk (Chunk_With_Children * parent, const char * sdata, size_t ssize);
@ -334,20 +285,6 @@ class TLT_Config_Chunk : public Chunk
public:
#if cencon
// constructor for default
TLT_Config_Chunk (Chunk_With_Children * parent, char const * rifname = 0)
: Chunk (parent, "TLTCONFG")
, num_shades_white(16)
, srcrifname(rifname ? new char [strlen(rifname)+1] : 0)
, blocks(TLTConfigBlock(0,0,1,1))
, table_size(256)
, palette_size(0)
{
for (int i=0; i<3; ++i) reserved[i]=0;
if (rifname) strcpy(srcrifname,rifname);
}
#endif
// constructor from buffer
TLT_Config_Chunk (Chunk_With_Children * parent, const char * sdata, size_t ssize);
@ -389,11 +326,6 @@ private:
};
#if cencon
extern TLT_Config_Chunk Default_TLT_Config_Chunk;
#endif
// Multi-Palettes for one environment
@ -558,17 +490,6 @@ class Environment_Game_Mode_Chunk : public Chunk_With_Children
public:
#if cencon
// constructor from data
Environment_Game_Mode_Chunk (Environment_Data_Chunk * const parent, const char * _mode_id);
// defined in gmodlink
void remove(class CWnd * const pWnd); // update this copy by finding its original
void update(class CWnd * const pWnd, BOOL bDoSoftwareTex); // update this copy by finding its original
void been_updated(class CWnd * const pWnd, BOOL bDoSoftwareTex); // find and update copies from this original
void definite_update(Environment_Game_Mode_Chunk const * const src, class CWnd * const pWnd, Environment_Data_Chunk * envd, BOOL bDoSoftwareTex);
#endif
// constructor from buffer
Environment_Game_Mode_Chunk (Chunk_With_Children * const parent, const char * sdata, size_t const ssize);
@ -681,48 +602,6 @@ private:
int version_num;
#if cencon
// constructor from parent
Environment_Game_Mode_Header_Chunk (Environment_Game_Mode_Chunk * const parent, const char * const _mode_id)
: Chunk (parent, "GMODHEAD"), version_num(0),
flags (0), rif_files()
{
for (int i=0; i<ChunkGMod_NumReserved; i++)
{
reserved[i] = 0;
}
mode_identifier = new char[strlen(_mode_id)+1];
strcpy(mode_identifier,_mode_id);
parent->header = this;
}
inline Environment_Game_Mode_Header_Chunk const & operator = (Environment_Game_Mode_Header_Chunk & s)
{
flags = s.flags;
while (rif_files.size())
{
delete[] rif_files.first_entry();
rif_files.delete_first_entry();
}
if (mode_identifier) delete[] mode_identifier;
mode_identifier = new char[strlen(s.mode_identifier)+1];
strcpy(mode_identifier,s.mode_identifier);
for (LIF<char *> src(&s.rif_files); !src.done(); src.next())
{
add_rif_entry(src());
}
version_num = s.version_num;
return *this;
}
#endif
// deconstructor
~Environment_Game_Mode_Header_Chunk();
@ -826,10 +705,6 @@ public:
{
return _stricmp(filename,c.filename);
}
#if cencon
void DeleteAssociatedFiles(RIF_Child_Chunk const *, Environment_Data_Chunk *) const;
#endif
};
enum RCC_Flags {
@ -845,13 +720,6 @@ class RIF_Child_Chunk : public Chunk
{
public:
#if cencon
RIF_Child_Chunk(Environment_Game_Mode_Chunk * const parent, const char * fname, class CWnd * const pWnd, BOOL bDoSoftwareTex);
void update(class CWnd * const, BOOL bDoSoftwareTex);
void update(class Environment * e, BOOL bDoSoftwareTex); // for where the environment is already loaded
void DeleteAssociatedFiles(Environment_Data_Chunk *) const;
#endif
// constructor from buffer
RIF_Child_Chunk (Chunk_With_Children * const parent, const char * sdata, size_t const ssize);
~RIF_Child_Chunk();
@ -903,35 +771,6 @@ class Preset_Palette_Store_Chunk : public Chunk
{
public:
#if cencon
// constructor from Preset_Palette_Chunk
Preset_Palette_Store_Chunk (Chunk_With_Children * const parent, Preset_Palette_Chunk const * const schunk, const char * const srname)
: Chunk (parent,"SETPALST")
, flags(schunk->flags)
, version_num(schunk->version_num)
, reserved1(schunk->reserved1)
, reserved2(schunk->reserved2)
, reserved3(schunk->reserved3)
, rifname(new char[strlen(srname)+1])
, pplist(schunk->pplist)
{
strcpy(rifname,srname);
}
// empty constructor
Preset_Palette_Store_Chunk (Chunk_With_Children * const parent, const char * const srname)
: Chunk (parent,"SETPALST")
, flags(0)
, version_num(0)
, reserved1(0)
, reserved2(0)
, reserved3(0)
, rifname(new char[strlen(srname)+1])
{
strcpy(rifname,srname);
}
#endif
// constructor from buffer
Preset_Palette_Store_Chunk (Chunk_With_Children * const parent, char const * sdata, size_t const ssize);
~Preset_Palette_Store_Chunk ()
@ -983,10 +822,6 @@ class Coloured_Polygons_Lookup_Chunk : public Chunk
{
public:
#if cencon
// constructor from data - defined in cencon
Coloured_Polygons_Lookup_Chunk (Chunk_With_Children * parent, PPM_Header * const palette);
#endif
// constructor from buffer
Coloured_Polygons_Lookup_Chunk (Chunk_With_Children * parent, const char * sdata, size_t ssize);

View file

@ -1,9 +1,5 @@
#include "dummyobjectchunk.hpp"
#ifdef cencon
#define new my_new
#endif
//macro for helping to force inclusion of chunks when using libraries
FORCE_CHUNK_INCLUDE_IMPLEMENT(dummyobjectchunk)

View file

@ -1,10 +1,6 @@
#include "enumchnk.hpp"
//#include "enumsch.hpp"
#ifdef cencon
#define new my_new
#endif
//macro for helping to force inclusion of chunks when using libraries
FORCE_CHUNK_INCLUDE_IMPLEMENT(enumchnk)

View file

@ -2,10 +2,6 @@
#include "enumsch.hpp"
#ifdef cencon
#define new my_new
#endif
//macro for helping to force inclusion of chunks when using libraries
FORCE_CHUNK_INCLUDE_IMPLEMENT(enumsch)

View file

@ -45,10 +45,6 @@ public:
List<Enum_Constant> enums;
virtual ~Enum_Const_List(){}
#if cencon
int lowest_free_index(void);
void Sort_By_Name(void);
#endif
};
@ -58,16 +54,6 @@ public:
// constructor from buffer
BMP_Enums_Chunk (Chunk_With_Children * const parent, char const * sdata, size_t const ssize);
#if cencon
// empty constructor
BMP_Enums_Chunk (Chunk_With_Children * const parent)
: Chunk(parent,"BMPENUMS")
, ctype(0)
, reserved1(0)
, reserved2(0)
{}
#endif
~BMP_Enums_Chunk ()
{
if (ctype) delete[] ctype;

View file

@ -1,9 +1,5 @@
#include "gsprchnk.hpp"
#ifdef cencon
#define new my_new
#endif
//macro for helping to force inclusion of chunks when using libraries
FORCE_CHUNK_INCLUDE_IMPLEMENT(gsprchnk)

View file

@ -29,12 +29,7 @@
#define LIST_TEM_TYPEID_THIS "?"
#endif
#if defined(engine)
// Not all preprocessors do lazy evaluation. DW
#if engine
#include "mem3dc.h"
#endif
#endif
#include "mem3dc.h"
#ifdef NDEBUG
static void fail(...) {}

View file

@ -3,10 +3,6 @@
#include "ltchunk.hpp"
#ifdef cencon
#define new my_new
#endif
//macro for helping to force inclusion of chunks when using libraries
FORCE_CHUNK_INCLUDE_IMPLEMENT(ltchunk)
@ -150,35 +146,9 @@ Light_Chunk::Light_Chunk(Chunk_With_Children * parent, const char * data, size_t
data += 4;
light.pad2 = *((int *) data);
#if engine || cencon
light_added_to_module = FALSE;
#endif
}
#if InterfaceEngine
AVP_Strategy_Chunk* Light_Chunk::GetStrategyChunk()
{
List<Chunk*> chlist;
parent->lookup_child("AVPSTRAT",chlist);
for(LIF<Chunk*> chlif(&chlist);!chlif.done();chlif.next())
{
AVP_Strategy_Chunk* asc=(AVP_Strategy_Chunk*)chlif();
if(asc->index==light.light_number) return asc;
}
return 0;
}
AVP_Strategy_Chunk* Light_Chunk::CreateStrategyChunk()
{
AVP_Strategy_Chunk* asc=GetStrategyChunk();
if(asc) return asc;
asc=new AVP_Strategy_Chunk(parent);
asc->index=light.light_number;
return asc;
}
#endif
////////////////////////////////////////////////////////////////////////////////////

View file

@ -4,9 +4,6 @@
#include "chunk.hpp"
#include "chnktype.hpp"
#if InterfaceEngine
#include "strachnk.hpp"
#endif
#define LOFlag_On 0x00000001
#define LOFlag_ShadowData 0x00000002
@ -143,11 +140,6 @@ public:
void fill_data_block ( char * data_start);
#if InterfaceEngine
AVP_Strategy_Chunk* GetStrategyChunk();
AVP_Strategy_Chunk* CreateStrategyChunk();
#endif
private:
friend class Light_Set_Chunk;

View file

@ -10,17 +10,9 @@
#include "huffman.hpp"
#ifdef cencon
#define new my_new
#endif
// Class Lockable_Chunk_With_Children functions
#if cencon
#else
extern char * users_name;
#endif
//macro for helping to force inclusion of chunks when using libraries
FORCE_CHUNK_INCLUDE_IMPLEMENT(mishchnk)
@ -1033,12 +1025,6 @@ BOOL File_Chunk::check_file()
}
#if InterfaceEngine
extern File_Chunk * Env_Chunk;
#endif
BOOL File_Chunk::update_file()
{
@ -1074,22 +1060,6 @@ BOOL File_Chunk::update_file()
#else
#if InterfaceEngine
// log, to track error
char fname [256];
char * dotpos;
strcpy (fname, filename);
dotpos = strrchr (fname, '.');
sprintf (dotpos, ".log");
FILE * log = fopen (fname, "a");
#endif
if (!filename) return FALSE;
twprintf("Updating %s\n",filename);
@ -1237,13 +1207,6 @@ BOOL File_Chunk::update_file()
ed = (Environment_Data_Chunk *)lookup_single_child ("REBENVDT");
if (ed)
{
#if InterfaceEngine
fprintf (log, "Env_Data %d %d %d %d", ed->updated, ed->local_lock, ed->updated_outside, ed->external_lock);
#endif
if (ed->updated &&
!(ed->updated_outside || ed->external_lock))
ed->update_chunk_in_file(rif_file);
@ -1272,11 +1235,6 @@ BOOL File_Chunk::update_file()
CloseHandle (rif_file);
#if InterfaceEngine
fclose (log);
#endif
return TRUE;
#endif //DisableLock

View file

@ -6,29 +6,13 @@
#include "chnktype.hpp"
#if engine
#define UseLocalAssert No
#include "ourasert.h"
#define assert(x) GLOBALASSERT(x)
#else
#if cencon
#include "ccassert.h"
#else
#include <assert.h>
#endif
#endif
#if cencon
#include "output.hpp"
#else
#define twprintf printf
extern char * users_name;
#endif
class File_Chunk;
@ -244,8 +228,4 @@ private:
};
#endif

View file

@ -7,9 +7,6 @@
#include "md5.h"
// Class Object_Chunk functions
#ifdef cencon
#define new my_new
#endif
//macro for helping to force inclusion of chunks when using libraries
FORCE_CHUNK_INCLUDE_IMPLEMENT(obchunk)
@ -402,19 +399,7 @@ ObjectID Object_Chunk::CalculateID()
if(!chlist.size()) return retval;
char Name[100];
#if InterfaceEngine||cencon
//need to check for console specific rif files,and skip the 'sat' or 'psx'
//so that they get the same ids as the pc
const char* r_name=((RIF_Name_Chunk*)chlist.first_entry())->rif_name;
if(tolower(r_name[0])=='p' && tolower(r_name[1])=='s' && tolower(r_name[2])=='x' )
strcpy(Name,&r_name[3]);
else if (tolower(r_name[0])=='s' && tolower(r_name[1])=='a' && tolower(r_name[2])=='t' )
strcpy(Name,&r_name[3]);
else
strcpy(Name,r_name);
#else
strcpy(Name,((RIF_Name_Chunk*)chlist.first_entry())->rif_name);
#endif
strcat(Name,object_data.o_name);
char buffer[16];

View file

@ -1,13 +1,6 @@
#if objedit
#include "template.hpp"
#endif
#include "oechunk.h"
#include "chunk.hpp"
#ifdef cencon
#define new my_new
#endif
//macro for helping to force inclusion of chunks when using libraries
FORCE_CHUNK_INCLUDE_IMPLEMENT(oechunk)
@ -163,5 +156,3 @@ BOOL Strategy_Chunk::output_chunk(HANDLE &hand)
return TRUE;
}

View file

@ -4,21 +4,6 @@
#include "chunk.hpp"
#include "obchunk.hpp"
#if objedit
#include "template.hpp"
#endif
//#if engine
//#define VECTOR VECTORCH
//#endif
#if engine
#else
struct VECTORCH
{
int vx, vy, vz;
};
#endif
struct ChunkMapBlock
{
char TemplateName[20];
@ -96,4 +81,5 @@ public :
//constructor from buffer
Strategy_Chunk (Chunk_With_Children * parent,const char* data,size_t);
};
#endif

View file

@ -6,19 +6,6 @@
#include "obchunk.hpp"
#if cencon || InterfaceEngine
#include "fnamefnc.hpp"
#include "zsp.hpp"
#include "bmpnames.hpp"
#include "envchunk.hpp"
#include "animchnk.hpp"
#include "chunkpal.hpp"
#include "fragchnk.hpp"
#endif
#ifdef cencon
#define new my_new
#endif
//macro for helping to force inclusion of chunks when using libraries
FORCE_CHUNK_INCLUDE_IMPLEMENT(shpchunk)
@ -97,14 +84,6 @@ Shape_Chunk::Shape_Chunk(Chunk_With_Children * parent, const char *data, size_t
**----------------------------------------------------------------------------*/
}
#if cencon || InterfaceEngine
List<Chunk*>chlist;
lookup_child("CONSHAPE",chlist);
for(LIF<Chunk*> chlif(&chlist);!chlif.done();chlif.next())
{
((Console_Shape_Chunk*)chlif())->generate_console_chunkshape();
}
#endif
}
Shape_Chunk::Shape_Chunk (Chunk_With_Children * parent, ChunkShape &shp_dat)
@ -1591,501 +1570,10 @@ Shape_External_File_Chunk::Shape_External_File_Chunk (Chunk_With_Children * pare
post_input_processing();
}
#if cencon || InterfaceEngine
void Shape_External_File_Chunk::update_from_external_rif(BOOL force_scale_update)
{
if(UpdatingExternalShape)
{
return;
}
Shape_Chunk * parent_shp = (Shape_Chunk *) parent;
Environment_Data_Chunk * envd = 0;
envd = (Environment_Data_Chunk *) parent_shp->parent->lookup_single_child("REBENVDT");
BOOL fixpal = IsFixedPalette(envd);
List<Chunk *> chlst;
lookup_child("SHPEXTFN",chlst);
if (chlst.size())
{
UpdatingExternalShape=TRUE;
Shape_External_Filename_Chunk * sefc = (Shape_External_Filename_Chunk *)chlst.first_entry();
#if cencon
twprintf("Locating %s\n",sefc->file_name);
char * locatedfile = FindExistingFileInPath_PreferWriteable(CWnd::GetActiveWindow(),sefc->file_name,"RifSearchPath");
twprintf("Loading %s\n",locatedfile ? locatedfile : sefc->file_name);
RIF_File_Chunk * rfc = new RIF_File_Chunk (this, locatedfile ? locatedfile : sefc->file_name);
#elif InterfaceEngine
RIF_File_Chunk * rfc;
char * locatedfile = FindExistingFile_PreferWriteable(sefc->file_name,"RifSearchPath",FALSE);
if (locatedfile)
{
rfc = new RIF_File_Chunk (this, locatedfile);
}
else
{
UpdatingExternalShape=FALSE;
return;
}
#endif
//Now loaded external file,so UpdatingExternalShape can now be reset
UpdatingExternalShape=FALSE;
if (rfc->error_code != 0)
{
#if cencon
extern BOOL SuppressFailedToFindShapeRifErrors;
if(!SuppressFailedToFindShapeRifErrors)
{
char message[300];
sprintf(message,"Error loading shape rif : %s",locatedfile ? locatedfile : sefc->file_name);
twMessageBox(CWnd::GetActiveWindow(),message,"Tools Control Area", MB_TASKMODAL+MB_OK+MB_ICONHAND);
}
#endif
if (locatedfile)
{
delete[] locatedfile;
}
delete rfc;
return;
}
Shape_Chunk* shp=0;
lookup_child("EXTOBJNM",chlst);
if(chlst.size())
{
//we have an object name so we need to search for the correct object in the file
Shape_External_Object_Name_Chunk* seonm=(Shape_External_Object_Name_Chunk*) chlst.first_entry();
rfc->lookup_child("RBOBJECT",chlst);
for(LIF<Chunk*> chlif(&chlst);!chlif.done();chlif.next())
{
Object_Chunk* oc=(Object_Chunk*)chlif();
if(!strcmp(oc->object_data.o_name,seonm->object_name))break;
}
if(chlif.done())
{
//can't find the object
#if cencon
char message[300];
sprintf(message,"Failed to find %s in %s\n(There may be several different rif files with the same name)",seonm->object_name,locatedfile);
twMessageBox(CWnd::GetActiveWindow(),message,"Tools Control Area", MB_TASKMODAL+MB_OK+MB_ICONHAND);
#endif
delete [] locatedfile;
delete rfc;
return;
}
shp=((Object_Chunk*)chlif())->get_assoc_shape();
}
else
{
//no object name,so there has to be just one shape in the file
rfc->lookup_child("REBSHAPE",chlst);
if (chlst.size() != 1)
{
#if cencon
char message[300];
sprintf(message,"There are %d shapes in %s\n(There should only be one)\n",chlst.size(),locatedfile);
twMessageBox(CWnd::GetActiveWindow(),message,"Tools Control Area", MB_TASKMODAL+MB_OK+MB_ICONHAND);
#endif
Environment_Data_Chunk * edc = 0;
edc = (Environment_Data_Chunk *)rfc->lookup_single_child("REBENVDT");
if(edc)
{
lookup_child("RIFFNAME",chlst);
while (chlst.size())
{
delete chlst.first_entry();
chlst.delete_first_entry();
}
edc->lookup_child("RIFFNAME",chlst);
if (chlst.size())
{
new RIF_Name_Chunk (this, ((RIF_Name_Chunk *)chlst.first_entry())->rif_name);
}
}
delete [] locatedfile;
delete rfc;
return;
}
shp = (Shape_Chunk *)chlst.first_entry();
}
delete [] locatedfile;
locatedfile=0;
// set so that it updates it whatever
if (shp->get_header()->version_no != sefc->version_no || TRUE)
{
//if the shape doesn't have any associated objects,get scale from external file's
//environment scale chunk.
//also get scale if force_scale_update is true
if(parent_shp->list_assoc_objs().size()==0 || force_scale_update)
{
if(force_scale_update)
{
sefc->rescale=1;
}
List<Chunk*> chlist=rfc->lookup_child("REBENVDT");
if(chlist.size())
{
chlist=((Chunk_With_Children*)chlist.first_entry())->lookup_child("ENVSDSCL");
if(chlist.size())
{
Environment_Scale_Chunk* esc =(Environment_Scale_Chunk*)chlist.first_entry();
sefc->rescale=esc->scale;
}
}
}
// copy all the data over from the loaded shape into the parent
ChunkShape cs = shp->shape_data;
cs.rescale(sefc->rescale);
// here we may want to sort out texture index nos.
// hmmm fix me
// definitely fixme...
// everytime the file is loaded,
// the shape is updated, and its bmps
// and thus the palette-up-to-date flag is reset,
// and the machine reckons on a new palette.
parent_shp->local_lock = TRUE;
parent_shp->update_my_chunkshape (cs);
parent_shp->local_lock = FALSE;
// delete all other chunks in the parent shape
// apart form the header !!!!
parent_shp->destroy_auxiliary_chunks();
char * tempbuffer;
Chunk* child_chunk;
child_chunk=shp->lookup_single_child("SHPZSPDT");
if (child_chunk)
{
tempbuffer = child_chunk->make_data_block_from_chunk();
new Shape_ZSP_Data_Chunk (parent_shp, (tempbuffer + 12), (*(int *) (tempbuffer + 8))-12);
delete [] tempbuffer;
}
child_chunk = shp->lookup_single_child("SHPMRGDT");
if (child_chunk)
{
tempbuffer = child_chunk->make_data_block_from_chunk();
new Shape_Merge_Data_Chunk (parent_shp, (tempbuffer + 12), (*(int *) (tempbuffer + 8))-12);
delete [] tempbuffer;
}
child_chunk = shp->lookup_single_child("SHPMORPH");
if (child_chunk)
{
tempbuffer = child_chunk->make_data_block_from_chunk();
new Shape_Morphing_Data_Chunk (parent_shp, (tempbuffer + 12), (*(int *) (tempbuffer + 8))-12);
delete [] tempbuffer;
}
child_chunk = shp->lookup_single_child("TEXTANIM");
if (child_chunk)
{
tempbuffer = child_chunk->make_data_block_from_chunk();
new Animation_Chunk (parent_shp, (tempbuffer + 12), (*(int *) (tempbuffer + 8))-12);
delete [] tempbuffer;
}
child_chunk = shp->lookup_single_child("SHPPCINF");
if (child_chunk)
{
tempbuffer = child_chunk->make_data_block_from_chunk();
new Shape_Poly_Change_Info_Chunk (parent_shp, (tempbuffer + 12), (*(int *) (tempbuffer + 8))-12);
delete [] tempbuffer;
}
child_chunk = shp->lookup_single_child("SHPFRAGS");
if (child_chunk)
{
tempbuffer = child_chunk->make_data_block_from_chunk();
Shape_Fragments_Chunk * sfc = new Shape_Fragments_Chunk (parent_shp, (tempbuffer + 12), (*(int *) (tempbuffer + 8))-12);
List<Chunk *> cl2;
sfc->lookup_child("SUBSHAPE",cl2);
for (LIF<Chunk *> cli2(&cl2); !cli2.done(); cli2.next())
{
Shape_Sub_Shape_Chunk * sssc = (Shape_Sub_Shape_Chunk *)cli2();
ChunkShape sscs = sssc->shape_data;
sscs.rescale(sefc->rescale);
sssc->update_my_chunkshape (sscs);
Shape_Fragment_Location_Chunk * sflc = (Shape_Fragment_Location_Chunk *)sssc->lookup_single_child("FRAGLOCN");
if (sflc)
{
sflc->frag_loc.x =(int) (sflc->frag_loc.x*sefc->rescale);
sflc->frag_loc.y =(int) (sflc->frag_loc.y*sefc->rescale);
sflc->frag_loc.z =(int) (sflc->frag_loc.z*sefc->rescale);
}
}
delete [] tempbuffer;
}
shp->lookup_child("ANIMSEQU",chlst);
for(LIF<Chunk*> chlif(&chlst);!chlif.done();chlif.next())
{
Anim_Shape_Sequence_Chunk* assc=(Anim_Shape_Sequence_Chunk*)chlif();
new Anim_Shape_Sequence_Chunk(parent_shp,&assc->sequence_data);
}
child_chunk = shp->lookup_single_child("PNOTINBB");
if(child_chunk)
{
tempbuffer = child_chunk->make_data_block_from_chunk();
new Poly_Not_In_Bounding_Box_Chunk (parent_shp, (tempbuffer + 12), (*(int *) (tempbuffer + 8))-12);
delete [] tempbuffer;
}
child_chunk = shp->lookup_single_child("ANSHCEN2");
if(child_chunk)
{
tempbuffer = child_chunk->make_data_block_from_chunk();
new Anim_Shape_Centre_Chunk (parent_shp, (tempbuffer + 12), (*(int *) (tempbuffer + 8))-12);
delete [] tempbuffer;
}
child_chunk = shp->lookup_single_child("ASALTTEX");
if(child_chunk)
{
tempbuffer = child_chunk->make_data_block_from_chunk();
new Anim_Shape_Alternate_Texturing_Chunk (parent_shp, (tempbuffer + 12), (*(int *) (tempbuffer + 8))-12);
delete [] tempbuffer;
}
shp->lookup_child("CONSHAPE",chlst);
for(chlif.restart();!chlif.done();chlif.next())
{
tempbuffer = chlif()->make_data_block_from_chunk();
Console_Shape_Chunk* csc=new Console_Shape_Chunk (parent_shp, (tempbuffer + 12), (*(int *) (tempbuffer + 8))-12);
csc->generate_console_chunkshape();
delete [] tempbuffer;
}
parent_shp->updated = TRUE;
sefc->version_no = shp->get_header()->version_no;
}
Bitmap_List_Store_Chunk * blsc = 0;
Global_BMP_Name_Chunk * gbnc = 0;
Environment_Data_Chunk * edc = 0;
edc = (Environment_Data_Chunk *)rfc->lookup_single_child("REBENVDT");
if (edc)
{
gbnc = (Global_BMP_Name_Chunk *) edc->lookup_single_child("BMPNAMES");
if (gbnc)
{
if (!gbnc->bmps.size()) gbnc = 0;
}
List<Chunk *> oldlst;
lookup_child("BMPLSTST",oldlst);
if (oldlst.size()>1)
{
while (oldlst.size())
{
delete oldlst.first_entry();
oldlst.delete_first_entry();
}
}
if (oldlst.size())
{
blsc = (Bitmap_List_Store_Chunk *)oldlst.first_entry();
}
else
{
if (gbnc) blsc = new Bitmap_List_Store_Chunk(this);
}
BMP_Names_ExtraData * extended = 0;
if (blsc)
{
extended = blsc->GetExtendedData();
if (fixpal)
extended->flags = (GlobalBMPFlags)(extended->flags | GBF_FIXEDPALETTE);
else
extended->flags = (GlobalBMPFlags)(extended->flags & ~GBF_FIXEDPALETTE);
}
if (gbnc)
{
//if ((gbnc->get_version_num()!=blsc->get_version_num()) || (gbnc->bmps.size() != blsc->bmps.size()))
/*update regardless of version number*/
{ // other checks could be done as well
if (blsc->bmps.size())
{
BOOL neednewpalette = FALSE;
List<BMP_Name> newlist = gbnc->bmps;
for (LIF<BMP_Name> newLIF(&newlist); !newLIF.done(); newLIF.next())
{
BMP_Name newcur = newLIF();
newcur.flags = (BMPN_Flags) (newcur.flags & ~(COMPLETED_BMPN_FLAGS | ChunkBMPFlag_FixedPalette));
if (fixpal) newcur.flags = (BMPN_Flags) (newcur.flags | ChunkBMPFlag_FixedPalette);
for (LIF<BMP_Name> oldLIF(&blsc->bmps); !oldLIF.done(); oldLIF.next())
{
BMP_Name oldcur = oldLIF();
if (newcur == oldcur)
{
// do we need to requantize?
if ((oldcur.flags ^ newcur.flags) & CHECKMODIFY_BMPN_FLAGS
|| newcur.flags & ChunkBMPFlag_UsesTransparency
&& !(newcur.flags & ChunkBMPFlag_IFF)
&& !(oldcur.flags & ChunkBMPFlag_IFF)
&& oldcur.DifferentTransparencyColour(newcur))
oldcur.flags = (BMPN_Flags)(oldcur.flags & ~COMPLETED_BMPN_FLAGS);
// keep some of the old flags - the ones that can differ
newcur.flags = (BMPN_Flags)(newcur.flags & COPY_BMPN_FLAGS);
newcur.flags = (BMPN_Flags)(newcur.flags | oldcur.flags & ~COPY_BMPN_FLAGS);
if (oldcur.version_num != newcur.version_num)
{
neednewpalette = TRUE;
newcur.flags = (BMPN_Flags)(newcur.flags & ~ChunkBMPFlag_HistogramExists);
extended->flags = (GlobalBMPFlags)(extended->flags & ~GBF_HISTOGRAMEXISTS);
}
break;
}
}
if (oldLIF.done())
{
// reset palette up to date flag
neednewpalette = TRUE;
newcur.flags = (BMPN_Flags)(newcur.flags & ~(ChunkBMPFlag_HistogramExists | COMPLETED_BMPN_FLAGS));
extended->flags = (GlobalBMPFlags)(extended->flags & ~GBF_HISTOGRAMEXISTS);
}
newLIF.change_current(newcur);
}
// check if any bitmaps have been removed
for (LIF<BMP_Name> bli(&blsc->bmps); !bli.done(); bli.next())
{
if (!newlist.contains(bli()))
{
// delete assoc files
neednewpalette = TRUE;
extended->flags = (GlobalBMPFlags)(extended->flags & ~GBF_HISTOGRAMEXISTS);
}
}
if (neednewpalette)
{
Palette_Outdated(envd);
if (fixpal) FixedPalette_Outdated(envd);
envd->updated = TRUE;
}
blsc->bmps = newlist;
}
else
{
blsc->bmps = gbnc->bmps;
for (LIF<BMP_Name> flagresetLIF(&blsc->bmps); !flagresetLIF.done(); flagresetLIF.next())
{
BMP_Name current = flagresetLIF();
current.flags = (BMPN_Flags)(current.flags & (COPY_BMPN_FLAGS & ~ChunkBMPFlag_FixedPalette));
if (fixpal) current.flags = (BMPN_Flags) (current.flags | ChunkBMPFlag_FixedPalette);
flagresetLIF.change_current(current);
}
// reset palette up to date flag
extended->flags = (GlobalBMPFlags)(extended->flags & ~GBF_HISTOGRAMEXISTS);
Palette_Outdated(envd);
if (fixpal) FixedPalette_Outdated(envd);
envd->updated = TRUE;
}
blsc->max_index = gbnc->max_index;
blsc->set_version_num(gbnc->get_version_num());
parent_shp->updated = TRUE;
}
}
else
{
if (blsc)
{
if (blsc->bmps.size())
{
// reset palette up to date flag
extended->flags = (GlobalBMPFlags)(extended->flags & ~GBF_HISTOGRAMEXISTS);
Palette_Outdated(envd);
if (fixpal) FixedPalette_Outdated(envd);
envd->updated = TRUE;
parent_shp->updated = TRUE;
}
delete blsc;
}
}
}
lookup_child("RIFFNAME",chlst);
while (chlst.size())
{
delete chlst.first_entry();
chlst.delete_first_entry();
}
if (edc)
{
edc->lookup_child("RIFFNAME",chlst);
if (chlst.size())
{
new RIF_Name_Chunk (this, ((RIF_Name_Chunk *)chlst.first_entry())->rif_name);
}
}
delete rfc;
}
}
void Shape_External_File_Chunk::post_input_processing()
{
update_from_external_rif(FALSE);
Chunk_With_Children::post_input_processing();
}
#else
void Shape_External_File_Chunk::post_input_processing()
{
Chunk_With_Children::post_input_processing();
}
#endif
const char* Shape_External_File_Chunk::get_shape_name()
{
@ -2546,14 +2034,6 @@ Shape_Sub_Shape_Chunk::Shape_Sub_Shape_Chunk(Chunk_With_Children * parent, const
data += *(int *)(data + 8);
}
#if cencon || InterfaceEngine
List<Chunk*>chlist;
lookup_child("CONSHAPE",chlist);
for(LIF<Chunk*> chlif(&chlist);!chlif.done();chlif.next())
{
((Console_Shape_Chunk*)chlif())->generate_console_chunkshape();
}
#endif
}
Shape_Sub_Shape_Chunk::Shape_Sub_Shape_Chunk (Chunk_With_Children * parent, ChunkShape &shp_dat)

View file

@ -769,10 +769,6 @@ public:
void post_input_processing();
#if cencon || InterfaceEngine
void update_from_external_rif(BOOL force_scale_update);
#endif
//gets name from shape_external_object_name_chunk if it has one
//otherwise takes name from rif_name_chunk
const char * get_shape_name();

View file

@ -4,9 +4,6 @@
#include "obchunk.hpp"
#include "md5.h"
#ifdef cencon
#define new my_new
#endif
//macro for helping to force inclusion of chunks when using libraries
FORCE_CHUNK_INCLUDE_IMPLEMENT(sndchunk)

View file

@ -1,15 +1,6 @@
#include "sprchunk.hpp"
#include "mishchnk.hpp"
#if cencon
#include "fnamefnc.hpp"
#include "bmpnames.hpp"
#include "shpchunk.hpp"
#endif
#ifdef cencon
#define new my_new
#endif
//macro for helping to force inclusion of chunks when using libraries
FORCE_CHUNK_INCLUDE_IMPLEMENT(sprchunk)
@ -300,260 +291,6 @@ BOOL Sprite_Header_Chunk::output_chunk(HANDLE & hand)
return TRUE;
}
#if cencon
void Sprite_Header_Chunk::post_input_processing()
{
if (parent)
{
List<Chunk *> chlst;
GetRootChunk()->lookup_child("REBENVDT",chlst);
Lockable_Chunk_With_Children * envd = 0;
if (chlst.size()) envd = (Lockable_Chunk_With_Children *) chlst.first_entry();
BOOL fixpal = IsFixedPalette(envd);
lookup_child("SHPEXTFN",chlst);
if (chlst.size())
{
Shape_External_Filename_Chunk * sefc = (Shape_External_Filename_Chunk *)chlst.first_entry();
#if cencon
twprintf("Locating %s\n",sefc->file_name);
char * locatedfile = FindExistingFileInPath_PreferWriteable(CWnd::GetActiveWindow(),sefc->file_name,"RifSearchPath");
twprintf("Loading %s\n",locatedfile ? locatedfile : sefc->file_name);
Sprite_Header_Chunk rfc(locatedfile ? locatedfile : sefc->file_name);
if (locatedfile)
{
delete[] locatedfile;
}
#else
Sprite_Header_Chunk rfc(sefc->file_name);
#endif
if (rfc.error_code != 0)
{
return;
}
lookup_child("SPRITVER",chlst);
int myver = -2;
if (chlst.size())
{
Sprite_Version_Number_Chunk * svnc = (Sprite_Version_Number_Chunk *)chlst.first_entry();
myver = svnc->version_num;
}
rfc.lookup_child("SPRITVER",chlst);
int yourver = -1;
if (chlst.size())
{
Sprite_Version_Number_Chunk * svnc = (Sprite_Version_Number_Chunk *)chlst.first_entry();
yourver = svnc->version_num;
}
if (yourver != myver)
{
#define NOT_A_BITMAP_RELATED_CHUNK \
strncmp ("BMPLSTST", child_ptr->identifier, 8) && \
strncmp ("BMNAMVER", child_ptr->identifier, 8) && \
strncmp ("BMNAMEXT", child_ptr->identifier, 8) && \
strncmp ("RIFFNAME", child_ptr->identifier, 8) && \
strncmp ("SHPEXTFN", child_ptr->identifier, 8) && \
strncmp ("BMPMD5ID", child_ptr->identifier, 8)
Chunk * child_ptr = children;
List <Chunk *> chunks_to_delete;
while (child_ptr != NULL)
{
if (NOT_A_BITMAP_RELATED_CHUNK)
{
chunks_to_delete.add_entry(child_ptr);
}
child_ptr = child_ptr->next;
}
for (LIF<Chunk *> delchunks(&chunks_to_delete); !delchunks.done(); delchunks.next())
{
delete delchunks();
}
child_ptr = rfc.children;
while (child_ptr != NULL)
{
if (NOT_A_BITMAP_RELATED_CHUNK)
{
#define CREATE_CHUNK_END(_datablock) \
new Miscellaneous_Chunk(this,_datablock,_datablock+12,*(int *)(_datablock+8)-12);
#define CREATE_CHUNK_FOR(_datablock,_id,_chunkclass) \
if (!strncmp(_datablock,_id,8)) { \
new _chunkclass(this,_datablock+12,*(int *)(_datablock+8)-12); \
} else
child_ptr->prepare_for_output();
char * datablock = child_ptr->make_data_block_from_chunk();
CREATE_CHUNK_FOR(datablock,"SPRITVER",Sprite_Version_Number_Chunk)
CREATE_CHUNK_FOR(datablock,"SPRITEPC",PC_Sprite_Chunk)
CREATE_CHUNK_FOR(datablock,"SPRITEPS",Playstation_Sprite_Chunk)
CREATE_CHUNK_FOR(datablock,"SPRITESA",Saturn_Sprite_Chunk)
CREATE_CHUNK_FOR(datablock,"SPRISIZE",Sprite_Size_Chunk)
CREATE_CHUNK_FOR(datablock,"SPRBMPSC",Sprite_Bitmap_Scale_Chunk)
CREATE_CHUNK_FOR(datablock,"SPRBMPCE",Sprite_Bitmap_Centre_Chunk)
CREATE_CHUNK_FOR(datablock,"SPREXTEN",Sprite_Extent_Chunk)
CREATE_CHUNK_END(datablock)
delete[] datablock;
}
child_ptr = child_ptr->next;
}
}
Chunk_With_BMPs * blsc = 0;
Chunk_With_BMPs * gbnc = 0;
rfc.lookup_child("BMPLSTST",chlst);
if (chlst.size())
{
gbnc = (Chunk_With_BMPs *) chlst.first_entry();
if (!gbnc->bmps.size()) gbnc = 0;
}
List<Chunk *> oldlst;
lookup_child("BMPLSTST",oldlst);
assert (oldlst.size()<2);
if (oldlst.size())
{
blsc = (Bitmap_List_Store_Chunk *)oldlst.first_entry();
}
else
{
if (gbnc) blsc = new Bitmap_List_Store_Chunk(this);
}
BMP_Names_ExtraData * extended = 0;
if (blsc)
{
extended = blsc->GetExtendedData();
if (fixpal)
extended->flags = (GlobalBMPFlags)(extended->flags | GBF_FIXEDPALETTE);
else
extended->flags = (GlobalBMPFlags)(extended->flags & ~GBF_FIXEDPALETTE);
}
if (gbnc)
{
if ((gbnc->get_version_num()!=blsc->get_version_num()) || (gbnc->bmps.size() != blsc->bmps.size()))
{ // other checks could be done as well
if (blsc->bmps.size())
{
BOOL neednewpalette = FALSE;
List<BMP_Name> newlist = gbnc->bmps;
for (LIF<BMP_Name> newLIF(&newlist); !newLIF.done(); newLIF.next())
{
BMP_Name newcur = newLIF();
newcur.flags = (BMPN_Flags) (newcur.flags & ~(COMPLETED_BMPN_FLAGS | ChunkBMPFlag_FixedPalette));
if (fixpal) newcur.flags = (BMPN_Flags) (newcur.flags | ChunkBMPFlag_FixedPalette);
for (LIF<BMP_Name> oldLIF(&blsc->bmps); !oldLIF.done(); oldLIF.next())
{
BMP_Name oldcur = oldLIF();
if (newcur == oldcur)
{
// do we need to requantize?
if ((oldcur.flags ^ newcur.flags) & CHECKMODIFY_BMPN_FLAGS
|| newcur.flags & ChunkBMPFlag_UsesTransparency
&& !(newcur.flags & ChunkBMPFlag_IFF)
&& !(oldcur.flags & ChunkBMPFlag_IFF)
&& oldcur.DifferentTransparencyColour(newcur))
oldcur.flags = (BMPN_Flags)(oldcur.flags & ~COMPLETED_BMPN_FLAGS);
// keep some of the old flags - the ones that can differ
newcur.flags = (BMPN_Flags)(newcur.flags & COPY_BMPN_FLAGS);
newcur.flags = (BMPN_Flags)(newcur.flags | oldcur.flags & ~COPY_BMPN_FLAGS);
if (oldcur.version_num != newcur.version_num)
{
neednewpalette = TRUE;
newcur.flags = (BMPN_Flags)(newcur.flags & ~ChunkBMPFlag_HistogramExists);
extended->flags = (GlobalBMPFlags)(extended->flags & ~GBF_HISTOGRAMEXISTS);
}
break;
}
}
if (oldLIF.done())
{
// reset palette up to date flag
neednewpalette = TRUE;
newcur.flags = (BMPN_Flags)(newcur.flags & ~(ChunkBMPFlag_HistogramExists | COMPLETED_BMPN_FLAGS));
extended->flags = (GlobalBMPFlags)(extended->flags & ~GBF_HISTOGRAMEXISTS);
}
newLIF.change_current(newcur);
}
// check if any bitmaps have been removed
for (LIF<BMP_Name> bli(&blsc->bmps); !bli.done(); bli.next())
{
if (!newlist.contains(bli()))
{
// delete assoc files
neednewpalette = TRUE;
extended->flags = (GlobalBMPFlags)(extended->flags & ~GBF_HISTOGRAMEXISTS);
}
}
if (neednewpalette)
{
Palette_Outdated(envd);
if (fixpal) FixedPalette_Outdated(envd);
envd->updated = TRUE;
}
blsc->bmps = newlist;
}
else
{
blsc->bmps = gbnc->bmps;
for (LIF<BMP_Name> flagresetLIF(&blsc->bmps); !flagresetLIF.done(); flagresetLIF.next())
{
BMP_Name current = flagresetLIF();
current.flags = (BMPN_Flags)(current.flags & (COPY_BMPN_FLAGS & ~ChunkBMPFlag_FixedPalette));
if (fixpal) current.flags = (BMPN_Flags) (current.flags | ChunkBMPFlag_FixedPalette);
flagresetLIF.change_current(current);
}
// reset palette up to date flag
extended->flags = (GlobalBMPFlags)(extended->flags & ~GBF_HISTOGRAMEXISTS);
Palette_Outdated(envd);
if (fixpal) FixedPalette_Outdated(envd);
envd->updated = TRUE;
}
blsc->max_index = gbnc->max_index;
blsc->set_version_num(gbnc->get_version_num());
assert (!strcmp("RSPRITES",parent->identifier));
((Lockable_Chunk_With_Children *)parent)->updated = TRUE;
}
}
else
{
if (blsc)
{
if (blsc->bmps.size())
{
// reset palette up to date flag
extended->flags = (GlobalBMPFlags)(extended->flags & ~GBF_HISTOGRAMEXISTS);
Palette_Outdated(envd);
if (fixpal) FixedPalette_Outdated(envd);
envd->updated = TRUE;
assert (!strcmp("RSPRITES",parent->identifier));
((Lockable_Chunk_With_Children *)parent)->updated = TRUE;
}
delete blsc;
}
}
}
}
Chunk_With_Children::post_input_processing();
}
#endif
RIF_IMPLEMENT_DYNCREATE_DECLARE_PARENT("SPRITEPC",PC_Sprite_Chunk,"SPRIHEAD",Sprite_Header_Chunk)
PC_Sprite_Chunk::PC_Sprite_Chunk(Sprite_Header_Chunk* parent,const char* data,size_t datasize)

View file

@ -9,9 +9,6 @@ struct Frame
int CentreX;
int CentreY;
int UVCoords[4][2];
#if cencon
int OldTexNum;
#endif
};
class Sprite_Header_Chunk : public Chunk_With_Children
@ -26,10 +23,6 @@ public:
int write_file(const char* fname);
virtual BOOL output_chunk(HANDLE &hand);
#if cencon
virtual void post_input_processing();
#endif
};
class PC_Sprite_Chunk : public Chunk_With_Children

View file

@ -1,9 +1,5 @@
#include "toolchnk.hpp"
#ifdef cencon
#define new my_new
#endif
//macro for helping to force inclusion of chunks when using libraries
FORCE_CHUNK_INCLUDE_IMPLEMENT(toolchnk)

View file

@ -1,263 +1,9 @@
#include <math.h>
#if cencon
#include "AFXWIN.H"
#include "list_tem.hpp"
#include "Vectors.hpp"
#include "environs.hpp"
#include "shpchunk.hpp"
#elif shpedit
#include "list_tem.hpp"
#include "Vectors.hpp"
#else
#include "list_tem.hpp"
#endif
#include "zsp.hpp"
#ifdef cencon
#define new my_new
#endif
#if shpedit
#define twprintf printf
#endif
// ZSP creation functions
#if cencon
void generate_zsp_data (int num_cubes, CWnd * pWnd)
{
Shape_Chunk * shpch = Sel_Obj->get_assoc_shape();
if (!shpch->lock_chunk(*(Main_Env.environment)))
{
char message[300];
char * locker = "Unknown";
Shape_Header_Chunk * head = shpch->get_header();
if (head)
locker = head->lock_user;
sprintf (message, "Shape locked by %s\n can not continue", locker);
pWnd->MessageBox (message, "Tools Control Area",
MB_ICONHAND + MB_OK + MB_TASKMODAL);
return;
}
start_text_window(pWnd);
ZSP_Data * zsp = new ZSP_Data (shpch->shape_data, num_cubes);
new Shape_ZSP_Data_Chunk (shpch, *zsp);
shpch->unlock_chunk (*(Main_Env.environment), TRUE);
stop_text_window();
delete zsp;
}
#endif
#if cencon || shpedit
ZSP_Data::ZSP_Data (const ChunkShape & shp, int num_cubes)
{
double xsize,ysize,zsize;
double max_size;
Vector cube_vector;
int num_subshapes;
xsize = fabs(shp.max.x) + fabs(shp.min.x);
ysize = fabs(shp.max.y) + fabs(shp.min.y);
zsize = fabs(shp.max.z) + fabs(shp.min.z);
max_size=max(xsize,ysize);
max_size=max(max_size,zsize);
cube_size = max_size / num_cubes;
int nc = num_cubes+2;
num_x_cubes = nc-(int) ( nc-(xsize / cube_size) );
num_y_cubes = nc-(int) ( nc-(ysize / cube_size) );
num_z_cubes = nc-(int) ( nc-(zsize / cube_size) );
cube_vector.x = cube_size / 2;
cube_vector.y = cube_size / 2;
cube_vector.z = cube_size / 2;
cube_radius = mod(cube_vector);
num_subshapes = num_x_cubes * num_y_cubes * num_z_cubes;
int i,j,k;
double xstart, ystart, zstart;
double xstart_tmp, ystart_tmp, zstart_tmp;
xstart = shp.min.x;
ystart = shp.min.y;
zstart = shp.min.z;
xstart_tmp = xstart;
twprintf ("Number of zones is \n",num_subshapes);
for(i = 0; i < num_x_cubes; i++) {
twprintf ("x = %d\n",i);
ystart_tmp = ystart;
for(j = 0; j < num_y_cubes; j++) {
twprintf ("y = %d\nz = ",j);
zstart_tmp = zstart;
for(k = 0; k < num_z_cubes; k++) {
twprintf ("%d ",k);
/* Process the subshape and update the ZSP pointer array */
ZSP_zone temp_zone(shp, xstart_tmp, ystart_tmp,
zstart_tmp, cube_size);
zone_array.add_entry(temp_zone);
zstart_tmp += cube_size;
}
twprintf ("\n");
ystart_tmp += cube_size;
}
xstart_tmp += cube_size;
}
}
static int zone_polygons[20000];
static unsigned char vertex_outcode [20000];
ZSP_zone::ZSP_zone (const ChunkShape & shp, double xstart, double ystart,
double zstart, double cube_size)
{
double xplane0, xplane1;
double yplane0, yplane1;
double zplane0, zplane1;
int i,j;
int outcode_or, outcode_and;
int vert_outcode;
num_z_polys = 0;
num_z_verts = 0;
/* Bounding planes in terms of axis limits */
xplane0 = xstart;
xplane1 = xstart + cube_size;
yplane0 = ystart;
yplane1 = ystart + cube_size;
zplane0 = zstart;
zplane1 = zstart + cube_size;
for (i=0; i<shp.num_polys; i++)
{
for (j=0; j<shp.poly_list[i].num_verts; j++)
{
vert_outcode = 0;
int point_no = shp.poly_list[i].vert_ind[j];
if(shp.v_list[point_no].x < xplane0) vert_outcode |= rsp_oc_x0;
if(shp.v_list[point_no].x > xplane1) vert_outcode |= rsp_oc_x1;
if(shp.v_list[point_no].y < yplane0) vert_outcode |= rsp_oc_y0;
if(shp.v_list[point_no].y > yplane1) vert_outcode |= rsp_oc_y1;
if(shp.v_list[point_no].z < zplane0) vert_outcode |= rsp_oc_z0;
if(shp.v_list[point_no].z > zplane1) vert_outcode |= rsp_oc_z1;
if(j==0) {
outcode_or = vert_outcode;
outcode_and = vert_outcode;
}
else {
outcode_or |= vert_outcode;
outcode_and &= vert_outcode;
}
}
if (outcode_and == 0)
{
zone_polygons[num_z_polys] = i;
num_z_polys++;
}
}
if (!num_z_polys)
{
z_poly_list=0;
z_vert_list=0;
return;
}
z_poly_list = new int [num_z_polys];
for (i=0; i<num_z_polys; i++)
{
z_poly_list[i] = zone_polygons[i];
}
for (i=0; i<shp.num_verts; i++)
{
vertex_outcode[i] = 0;
}
for (i=0; i<num_z_polys; i++)
{
for (j=0; j<shp.poly_list[z_poly_list[i]].num_verts; j++)
{
vertex_outcode[shp.poly_list[z_poly_list[i]].vert_ind[j]] = 1;
}
}
for (i=0; i<shp.num_verts; i++)
{
if (vertex_outcode[i]) num_z_verts++;
}
z_vert_list = new int[num_z_verts];
j=0;
for (i=0; i<shp.num_verts; i++)
{
if (vertex_outcode[i])
z_vert_list[j++] = i;
}
}
#endif
ZSP_Data::~ZSP_Data()
{
while (zone_array.size())

View file

@ -19,10 +19,6 @@ struct ChunkShape;
struct ZSP_zone
{
#if (cencon || shpedit)
ZSP_zone (const ChunkShape &, double, double, double, double);
#endif
ZSP_zone ();
~ZSP_zone();
@ -43,11 +39,6 @@ class ZSP_Data
{
public:
#if (cencon || shpedit)
ZSP_Data (const ChunkShape &, int);
#endif
ZSP_Data (const char * zdata, size_t zsize);
~ZSP_Data ();
@ -68,17 +59,6 @@ public:
class Shape_ZSP_Data_Chunk : public Chunk
{
public:
#if cencon || shpedit
Shape_ZSP_Data_Chunk (Shape_Sub_Shape_Chunk * parent, ZSP_Data zspin)
: Chunk(parent, "SHPZSPDT"), zspdata (zspin)
{}
Shape_ZSP_Data_Chunk (Shape_Chunk * parent, ZSP_Data zspin)
: Chunk(parent, "SHPZSPDT"), zspdata (zspin)
{}
#endif
const ZSP_Data zspdata;
size_t size_chunk ();