2000-12-12 21:56:51 +01:00
|
|
|
/***********************/
|
|
|
|
/*** Data Structures ***/
|
|
|
|
/***********************/
|
|
|
|
|
|
|
|
#ifndef __DATA_STRUCTS_HEADER__
|
|
|
|
#define __DATA_STRUCTS_HEADER__
|
2000-12-06 23:21:55 +01:00
|
|
|
|
2001-02-20 16:56:16 +01:00
|
|
|
//***************************************************************************
|
|
|
|
// Taken from Map editor layerdef.h
|
|
|
|
enum PSX_COLLSION_ENUM
|
|
|
|
{
|
2001-05-09 15:23:16 +02:00
|
|
|
COLLISION_TYPE_BLANK =0,
|
2001-05-09 23:20:02 +02:00
|
|
|
COLLISION_TYPE_NORMAL =0,
|
|
|
|
COLLISION_TYPE_DAMAGE =1,
|
|
|
|
COLLISION_TYPE_SLIPPERY =2,
|
|
|
|
COLLISION_TYPE_ELECTRIC =3,
|
|
|
|
COLLISION_TYPE_STICKY =4,
|
|
|
|
COLLISION_TYPE_WATER =5,
|
|
|
|
COLLISION_TYPE_SOLID =6,
|
|
|
|
COLLISION_TYPE_DEATH =7,
|
2001-05-16 21:10:13 +02:00
|
|
|
// COLLISION_TYPE_DESTRUCTABLE =8,
|
|
|
|
COLLISION_TYPE_DESTRUCTABLE =COLLISION_TYPE_STICKY,
|
2001-05-09 15:23:16 +02:00
|
|
|
|
|
|
|
COLLISION_TYPE_FLAG_SHIFT =5,
|
|
|
|
COLLISION_TYPE_FLAG_NORMAL =COLLISION_TYPE_NORMAL << COLLISION_TYPE_FLAG_SHIFT,
|
|
|
|
COLLISION_TYPE_FLAG_DAMAGE =COLLISION_TYPE_DAMAGE << COLLISION_TYPE_FLAG_SHIFT,
|
|
|
|
COLLISION_TYPE_FLAG_SLIPPERY =COLLISION_TYPE_SLIPPERY << COLLISION_TYPE_FLAG_SHIFT,
|
|
|
|
COLLISION_TYPE_FLAG_ELECTRIC =COLLISION_TYPE_ELECTRIC << COLLISION_TYPE_FLAG_SHIFT,
|
|
|
|
COLLISION_TYPE_FLAG_STICKY =COLLISION_TYPE_STICKY << COLLISION_TYPE_FLAG_SHIFT,
|
|
|
|
COLLISION_TYPE_FLAG_WATER =COLLISION_TYPE_WATER << COLLISION_TYPE_FLAG_SHIFT,
|
|
|
|
COLLISION_TYPE_FLAG_SOLID =COLLISION_TYPE_SOLID << COLLISION_TYPE_FLAG_SHIFT,
|
|
|
|
COLLISION_TYPE_FLAG_DEATH =COLLISION_TYPE_DEATH << COLLISION_TYPE_FLAG_SHIFT,
|
|
|
|
COLLISION_TYPE_FLAG_DESTRUCTABLE =COLLISION_TYPE_DESTRUCTABLE << COLLISION_TYPE_FLAG_SHIFT,
|
|
|
|
|
|
|
|
COLLISION_TYPE_MASK = ((0xff<<COLLISION_TYPE_FLAG_SHIFT)&0xff),
|
|
|
|
COLLISION_TILE_MASK = (0xff - COLLISION_TYPE_MASK)
|
2001-02-20 16:56:16 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
enum PSX_DATA_ENUM
|
|
|
|
{
|
|
|
|
LAYER_SHADE_RGB_MAX=4,
|
|
|
|
};
|
|
|
|
|
2001-01-12 23:37:21 +01:00
|
|
|
|
|
|
|
//***************************************************************************
|
|
|
|
//*** Base Types ************************************************************
|
2000-12-06 23:21:55 +01:00
|
|
|
//***************************************************************************
|
|
|
|
struct sShortXYZ
|
|
|
|
{
|
|
|
|
s16 vx,vy,vz;
|
|
|
|
};
|
|
|
|
|
|
|
|
//***************************************************************************
|
|
|
|
struct sVtx
|
|
|
|
{
|
2001-01-08 22:33:31 +01:00
|
|
|
s16 vx, vy, vz, pad;
|
|
|
|
|
2000-12-12 21:56:51 +01:00
|
|
|
#ifdef WIN32
|
|
|
|
bool operator==(sVtx const &v1) {return((vx==v1.vx) && (vy==v1.vy) && (vz==v1.vz));}
|
|
|
|
#endif
|
2000-12-06 23:21:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#define NormalScale 4096
|
|
|
|
struct sNormal
|
|
|
|
{
|
|
|
|
s16 nX,nY,nZ,pD;
|
|
|
|
};
|
|
|
|
|
2001-01-12 23:37:21 +01:00
|
|
|
//***************************************************************************
|
2000-12-06 23:21:55 +01:00
|
|
|
struct sBBox
|
|
|
|
{
|
2001-04-25 19:04:12 +02:00
|
|
|
s16 XMin,YMin;//,ZMin;
|
|
|
|
s16 XMax,YMax;//,ZMax;
|
2000-12-06 23:21:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
//***************************************************************************
|
2001-01-03 23:15:22 +01:00
|
|
|
|
2000-12-06 23:21:55 +01:00
|
|
|
struct sMat
|
|
|
|
{
|
|
|
|
u16 TPage;
|
|
|
|
u16 Clut;
|
|
|
|
// s32 DblFlag;
|
|
|
|
};
|
|
|
|
|
2001-01-12 23:37:21 +01:00
|
|
|
//***************************************************************************
|
|
|
|
//*** Poly Types ************************************************************
|
2000-12-06 23:21:55 +01:00
|
|
|
//***************************************************************************
|
|
|
|
struct sTri
|
|
|
|
{
|
2000-12-14 17:38:34 +01:00
|
|
|
u16 P0; // 2
|
|
|
|
u16 P1; // 2
|
2000-12-06 23:21:55 +01:00
|
|
|
u8 uv0[2]; // 2
|
2000-12-14 17:38:34 +01:00
|
|
|
u16 Clut; // 2
|
2000-12-06 23:21:55 +01:00
|
|
|
u8 uv1[2]; // 2
|
2001-04-19 01:04:03 +02:00
|
|
|
u16 TPage; // 2
|
2000-12-06 23:21:55 +01:00
|
|
|
u8 uv2[2]; // 2
|
2000-12-14 17:38:34 +01:00
|
|
|
u16 P2; // 2
|
2001-05-02 20:40:41 +02:00
|
|
|
u16 OTOfs; // 2
|
|
|
|
u8 PolyCode; // 1
|
|
|
|
u8 Pad; // 1
|
2001-04-19 01:04:03 +02:00
|
|
|
}; // 20
|
2000-12-06 23:21:55 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
struct sQuad
|
|
|
|
{
|
2001-01-04 22:53:14 +01:00
|
|
|
u16 P0; // 2
|
|
|
|
u16 P1; // 2
|
|
|
|
u16 P2; // 2
|
|
|
|
u16 P3; // 2
|
2000-12-06 23:21:55 +01:00
|
|
|
u8 uv0[2]; // 2
|
2001-01-04 22:53:14 +01:00
|
|
|
u16 Clut; // 2
|
2000-12-06 23:21:55 +01:00
|
|
|
u8 uv1[2]; // 2
|
2001-04-19 01:04:03 +02:00
|
|
|
u16 TPage; // 2
|
2000-12-06 23:21:55 +01:00
|
|
|
u8 uv2[2]; // 2
|
|
|
|
u8 uv3[2]; // 2
|
2001-05-02 20:40:41 +02:00
|
|
|
u16 OTOfs; // 2
|
|
|
|
u8 PolyCode; // 1
|
|
|
|
u8 Pad; // 1
|
2001-04-19 01:04:03 +02:00
|
|
|
}; // 24
|
2000-12-06 23:21:55 +01:00
|
|
|
|
2001-04-07 23:05:33 +02:00
|
|
|
|
2000-12-06 23:21:55 +01:00
|
|
|
//***************************************************************************
|
2001-01-12 23:37:21 +01:00
|
|
|
//*** Game Types and Headers ************************************************
|
2001-04-07 23:05:33 +02:00
|
|
|
//***************************************************************************
|
|
|
|
// Tiles
|
2001-04-19 01:04:03 +02:00
|
|
|
//typedef u16 sTileMapElem;
|
2001-04-07 23:05:33 +02:00
|
|
|
|
2001-04-19 01:04:03 +02:00
|
|
|
struct sTileMapElem
|
|
|
|
{
|
|
|
|
u16 Tile;
|
|
|
|
// u16 LightIdx;
|
|
|
|
};
|
|
|
|
/*
|
2001-04-07 23:05:33 +02:00
|
|
|
struct sTile
|
|
|
|
{
|
|
|
|
// 2d Tile
|
|
|
|
u8 u0,v0; // 2
|
|
|
|
u16 Clut; // 2
|
|
|
|
u16 TPage; // 2
|
|
|
|
u16 Pad; // :o( need this? // 2
|
|
|
|
}; // 8
|
2001-04-19 01:04:03 +02:00
|
|
|
*/
|
|
|
|
struct sTile2d
|
2001-04-07 23:05:33 +02:00
|
|
|
{
|
2001-04-19 01:04:03 +02:00
|
|
|
// 2d Tile
|
|
|
|
u8 u0,v0; // 2
|
|
|
|
u16 Clut; // 2
|
|
|
|
u16 TPage; // 2
|
|
|
|
u16 Pad; // :o( need this? // 2
|
|
|
|
}; // 8
|
2001-04-07 23:05:33 +02:00
|
|
|
|
2001-04-19 01:04:03 +02:00
|
|
|
struct sTile3d
|
2001-04-07 23:05:33 +02:00
|
|
|
{
|
2001-04-19 01:04:03 +02:00
|
|
|
// 3d Tile
|
|
|
|
u16 TriStart;
|
|
|
|
u16 TriCount;
|
|
|
|
u16 QuadStart;
|
|
|
|
u16 QuadCount;
|
|
|
|
}; // 8
|
2000-12-06 23:21:55 +01:00
|
|
|
//***************************************************************************
|
2000-12-12 21:56:51 +01:00
|
|
|
// Layers
|
|
|
|
struct sLayerHdr
|
|
|
|
{
|
|
|
|
int Type;
|
|
|
|
int SubType;
|
|
|
|
int Width;
|
|
|
|
int Height;
|
|
|
|
|
|
|
|
/*int TileData[W][H];....*/
|
|
|
|
};
|
|
|
|
|
2001-02-20 16:56:16 +01:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Shade Layer
|
2001-04-30 23:49:54 +02:00
|
|
|
struct sLayerShadeBackGfxType
|
2001-04-07 23:05:33 +02:00
|
|
|
{
|
|
|
|
u16 TPage;
|
|
|
|
u16 Clut;
|
|
|
|
u8 U,V;
|
|
|
|
u8 W,H;
|
2001-04-30 23:49:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct sLayerShadeBackGfx
|
|
|
|
{
|
|
|
|
u16 Type;
|
|
|
|
u16 Trans;
|
|
|
|
u16 PosX,PosY;
|
|
|
|
s8 Ofs[4][2];
|
|
|
|
u8 RGB[4][3];
|
2001-04-07 23:05:33 +02:00
|
|
|
};
|
|
|
|
|
2001-02-20 16:56:16 +01:00
|
|
|
struct sLayerShadeHdr
|
|
|
|
{
|
2001-04-30 23:49:54 +02:00
|
|
|
u16 BandCount;
|
|
|
|
u16 GfxCount;
|
|
|
|
u8 RGB[4][3];
|
|
|
|
sLayerShadeBackGfxType *TypeList;
|
|
|
|
sLayerShadeBackGfx *GfxList;
|
2001-02-20 16:56:16 +01:00
|
|
|
};
|
|
|
|
|
2001-04-21 00:20:58 +02:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
struct sModel
|
|
|
|
{
|
|
|
|
u16 TriCount;
|
|
|
|
u16 TriStart;
|
2001-05-03 17:22:19 +02:00
|
|
|
sBBox BBox;
|
2001-04-21 00:20:58 +02:00
|
|
|
};
|
2001-05-03 17:22:19 +02:00
|
|
|
|
2000-12-12 21:56:51 +01:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Header
|
2001-04-19 17:12:21 +02:00
|
|
|
struct sLevelHdr
|
2000-12-12 21:56:51 +01:00
|
|
|
{
|
|
|
|
u32 BackLayer;
|
|
|
|
u32 MidLayer;
|
|
|
|
u32 ActionLayer;
|
|
|
|
u32 ForeLayer;
|
2001-01-24 23:30:24 +01:00
|
|
|
u32 CollisionLayer;
|
2001-04-01 22:22:49 +02:00
|
|
|
u32 ActorList;
|
|
|
|
u32 ItemList;
|
|
|
|
u32 PlatformList;
|
2001-04-07 23:05:33 +02:00
|
|
|
u32 TriggerList;
|
|
|
|
u32 FXList;
|
2001-04-30 23:49:54 +02:00
|
|
|
u32 HazardList;
|
2001-04-19 01:04:03 +02:00
|
|
|
|
2001-04-07 23:05:33 +02:00
|
|
|
u16 PlayerStartX,PlayerStartY;
|
2001-04-19 01:04:03 +02:00
|
|
|
|
|
|
|
sTile2d *TileBank2d;
|
|
|
|
sTile3d *TileBank3d;
|
|
|
|
sTri *TriList;
|
|
|
|
sQuad *QuadList;
|
|
|
|
sVtx *VtxList;
|
2001-04-27 18:59:41 +02:00
|
|
|
sModel *ModelList;
|
2000-12-06 23:21:55 +01:00
|
|
|
};
|
|
|
|
|
2001-01-08 22:33:31 +01:00
|
|
|
//***************************************************************************
|
|
|
|
//***************************************************************************
|
|
|
|
//***************************************************************************
|
|
|
|
// Actors
|
2001-05-15 19:40:06 +02:00
|
|
|
struct sSpriteFrameGfx
|
|
|
|
{
|
|
|
|
u8 *PAKSpr; // 4 Needs to be u32, so might as well make it a ptr
|
|
|
|
u16 Pad; // 2 :o(
|
|
|
|
u8 W,H; // 2
|
|
|
|
};
|
|
|
|
|
2001-04-01 22:22:49 +02:00
|
|
|
struct sSpriteFrame
|
|
|
|
{
|
2001-05-15 19:40:06 +02:00
|
|
|
u16 FrameIdx;
|
|
|
|
s8 XOfs,YOfs;
|
|
|
|
|
2001-04-01 22:22:49 +02:00
|
|
|
};
|
2001-01-08 22:33:31 +01:00
|
|
|
|
2001-04-01 22:22:49 +02:00
|
|
|
struct sSpriteAnim
|
|
|
|
{
|
2001-05-15 19:40:06 +02:00
|
|
|
u16 FrameCount; // 2
|
|
|
|
u16 Pad;
|
|
|
|
sSpriteFrame *Anim; // 4
|
2001-04-01 22:22:49 +02:00
|
|
|
};
|
2001-03-05 21:18:35 +01:00
|
|
|
|
2001-04-01 22:22:49 +02:00
|
|
|
struct sSpriteAnimBank
|
2001-03-05 21:18:35 +01:00
|
|
|
{
|
2001-05-15 19:40:06 +02:00
|
|
|
u16 Clut; // 2
|
|
|
|
u16 AnimCount; // 2
|
|
|
|
u16 FrameCount; // 2
|
|
|
|
u8 MaxW,MaxH; // 2
|
|
|
|
|
|
|
|
u8 *Palette; // 4
|
|
|
|
sSpriteAnim *AnimList; // 4
|
|
|
|
sSpriteFrameGfx *FrameList; // 4
|
2001-04-01 22:22:49 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//***************************************************************************
|
|
|
|
//***************************************************************************
|
|
|
|
//***************************************************************************
|
|
|
|
// Things - Must be 4 byte aligned for pos data
|
2001-05-09 15:23:16 +02:00
|
|
|
enum THING_FLAG
|
|
|
|
{
|
|
|
|
THING_FLAG_COLLISION=1<<0,
|
|
|
|
THING_FLAG_MIRRORX=1<<1,
|
|
|
|
THING_FLAG_MIRRORY=1<<2,
|
|
|
|
};
|
|
|
|
|
2001-04-01 22:22:49 +02:00
|
|
|
struct sThingHdr
|
|
|
|
{
|
|
|
|
u16 Count;
|
2001-03-05 21:18:35 +01:00
|
|
|
u16 Pad;
|
|
|
|
};
|
|
|
|
|
2001-04-01 22:22:49 +02:00
|
|
|
struct sThingPoint
|
2001-01-08 22:33:31 +01:00
|
|
|
{
|
2001-04-01 22:22:49 +02:00
|
|
|
u16 X,Y;
|
2001-01-08 22:33:31 +01:00
|
|
|
};
|
2000-12-12 21:56:51 +01:00
|
|
|
|
2001-04-01 22:22:49 +02:00
|
|
|
struct sThingActor
|
2001-01-12 23:37:21 +01:00
|
|
|
{
|
2001-05-09 15:23:16 +02:00
|
|
|
u16 Type;
|
|
|
|
u16 Health;
|
|
|
|
u16 AttackStrength;
|
|
|
|
u16 Speed;
|
|
|
|
u16 TurnRate;
|
|
|
|
u8 Flags;
|
|
|
|
u8 Angle;
|
|
|
|
u8 PointCount;
|
2001-04-01 22:22:49 +02:00
|
|
|
// Point List...
|
|
|
|
}; // 12
|
|
|
|
|
|
|
|
struct sThingItem
|
|
|
|
{
|
|
|
|
u16 Type;
|
|
|
|
u16 Pad; // Poo!
|
|
|
|
sThingPoint Pos;
|
2001-01-12 23:37:21 +01:00
|
|
|
};
|
|
|
|
|
2001-04-01 22:22:49 +02:00
|
|
|
struct sThingPlatform
|
|
|
|
{
|
2001-05-09 15:23:16 +02:00
|
|
|
u16 Gfx;
|
|
|
|
u16 Type;
|
|
|
|
u16 Speed;
|
|
|
|
u16 TurnRate;
|
|
|
|
u16 Param0;
|
|
|
|
u8 Flags;
|
|
|
|
u8 PointCount;
|
2001-04-01 22:22:49 +02:00
|
|
|
// Point List...
|
|
|
|
}; // 10
|
2000-12-12 21:56:51 +01:00
|
|
|
|
2001-04-07 23:05:33 +02:00
|
|
|
struct sThingFX
|
|
|
|
{
|
|
|
|
u16 Type;
|
|
|
|
u16 Speed;
|
2001-05-09 15:23:16 +02:00
|
|
|
u8 Flags;
|
|
|
|
u8 Angle;
|
2001-04-07 23:05:33 +02:00
|
|
|
sThingPoint Pos,Size;
|
|
|
|
}; // 8
|
|
|
|
|
|
|
|
struct sThingTrigger
|
|
|
|
{
|
2001-05-09 15:23:16 +02:00
|
|
|
u16 Type;
|
2001-04-07 23:05:33 +02:00
|
|
|
sThingPoint Pos;
|
2001-05-09 15:23:16 +02:00
|
|
|
u8 Width,Height;
|
2001-05-02 14:46:49 +02:00
|
|
|
sThingPoint TargetPos;
|
2001-05-04 03:00:49 +02:00
|
|
|
sThingPoint TargetSize;
|
2001-04-07 23:05:33 +02:00
|
|
|
}; // 8
|
|
|
|
|
2001-04-30 23:49:54 +02:00
|
|
|
struct sThingHazard
|
|
|
|
{
|
|
|
|
u16 Gfx;
|
|
|
|
u16 Type;
|
|
|
|
u16 Health;
|
|
|
|
u16 AttackStrength;
|
|
|
|
u16 Speed;
|
|
|
|
u16 TurnRate;
|
|
|
|
u16 Respawn;
|
|
|
|
u8 Flags;
|
2001-05-09 15:23:16 +02:00
|
|
|
u8 Angle;
|
2001-04-30 23:49:54 +02:00
|
|
|
u8 PointCount;
|
|
|
|
// Point List...
|
|
|
|
}; // 12
|
|
|
|
|
2001-04-01 22:22:49 +02:00
|
|
|
//***************************************************************************
|
2000-12-06 23:21:55 +01:00
|
|
|
#endif
|