SBSPSS/tools/Data/include/dstructs.h

412 lines
9.0 KiB
C
Raw Normal View History

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-05-30 19:07:26 +02:00
2001-02-20 16:56:16 +01:00
//***************************************************************************
// Taken from Map editor layerdef.h
enum PSX_COLLSION_ENUM
{
2001-05-30 19:07:26 +02:00
COLLISION_TYPE_BLANK =0,
COLLISION_TYPE_NORMAL =0,
COLLISION_TYPE_DAMAGE =1,
COLLISION_TYPE_SLIPPERY =2,
COLLISION_TYPE_ELECTRIC =3,
COLLISION_TYPE_DESTRUCTABLE_WALL =4,
2001-06-01 00:02:07 +02:00
COLLISION_TYPE_SOAKUP =5,
2001-05-30 19:07:26 +02:00
COLLISION_TYPE_SOLID =6,
COLLISION_TYPE_DEATH_FALL =7,
COLLISION_TYPE_DESTRUCTABLE_FLOOR =8,
COLLISION_TYPE_DEATH_INSTANT =9,
COLLISION_TYPE_MOVE_LEFT =10,
COLLISION_TYPE_MOVE_RIGHT =11,
2001-06-01 00:02:07 +02:00
COLLISION_TYPE_DEATH_LIQUID =12,
2001-07-05 22:20:36 +02:00
COLLISION_TYPE_SB_NOMOVE =13,
2001-05-30 19:07:26 +02:00
COLLISION_TYPE_FLAG_SHIFT =3,
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_DESTRUCTABLE_WALL =COLLISION_TYPE_DESTRUCTABLE_WALL << COLLISION_TYPE_FLAG_SHIFT,
2001-06-01 00:02:07 +02:00
COLLISION_TYPE_FLAG_SOAKUP =COLLISION_TYPE_SOAKUP << COLLISION_TYPE_FLAG_SHIFT,
2001-05-30 19:07:26 +02:00
COLLISION_TYPE_FLAG_SOLID =COLLISION_TYPE_SOLID << COLLISION_TYPE_FLAG_SHIFT,
COLLISION_TYPE_FLAG_DEATH_FALL =COLLISION_TYPE_DEATH_FALL << COLLISION_TYPE_FLAG_SHIFT,
COLLISION_TYPE_FLAG_DESTRUCTABLE_FLOOR =COLLISION_TYPE_DESTRUCTABLE_FLOOR << COLLISION_TYPE_FLAG_SHIFT,
COLLISION_TYPE_FLAG_DEATH_INSTANT =COLLISION_TYPE_DEATH_INSTANT << COLLISION_TYPE_FLAG_SHIFT,
COLLISION_TYPE_FLAG_MOVE_LEFT =COLLISION_TYPE_MOVE_LEFT << COLLISION_TYPE_FLAG_SHIFT,
COLLISION_TYPE_FLAG_MOVE_RIGHT =COLLISION_TYPE_MOVE_RIGHT << COLLISION_TYPE_FLAG_SHIFT,
2001-06-01 00:02:07 +02:00
COLLISION_TYPE_FLAG_DEATH_LIQUID =COLLISION_TYPE_DEATH_LIQUID << COLLISION_TYPE_FLAG_SHIFT,
2001-07-05 22:20:36 +02:00
COLLISION_TYPE_FLAG_SB_NOMOVE =COLLISION_TYPE_SB_NOMOVE << COLLISION_TYPE_FLAG_SHIFT,
2001-05-09 15:23:16 +02:00
2001-05-30 19:07:26 +02:00
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-07-25 23:37:17 +02:00
s16 vx, vy, vz, rgb;
2001-01-08 22:33:31 +01:00
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-07-20 23:19:41 +02:00
s16 OTOfs; // 2
2001-05-02 20:40:41 +02:00
u8 PolyCode; // 1
u8 Pad; // 1
2001-07-25 23:37:17 +02:00
u8 C0,C1,C2;
u8 Pad2;
}; // 24
2000-12-06 23:21:55 +01:00
//---------------------------------------------------------------------------
struct sQuad
{
2001-01-04 22:53:14 +01:00
u16 P0; // 2
u16 P1; // 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
2001-07-20 18:17:26 +02:00
u16 P2; // 2
2000-12-06 23:21:55 +01:00
u8 uv3[2]; // 2
2001-07-20 18:17:26 +02:00
u16 P3; // 2
2001-07-20 23:19:41 +02:00
s16 OTOfs; // 2
2001-05-02 20:40:41 +02:00
u8 PolyCode; // 1
u8 Pad; // 1
2001-07-25 23:37:17 +02:00
u8 C0,C1,C2,C3;
}; // 28
2000-12-06 23:21:55 +01:00
2001-04-07 23:05:33 +02:00
2001-07-20 18:17:26 +02:00
struct sPoly
{
u16 P0; // 2
u16 P1; // 2
u16 P2; // 2
u16 P3; // 2
u8 uv0[2]; // 2
u16 Clut; // 2
u8 uv1[2]; // 2
u16 TPage; // 2
u8 uv2[2]; // 2
u8 uv3[2]; // 2
2001-07-20 23:19:41 +02:00
s16 OTOfs; // 2
2001-07-20 18:17:26 +02:00
u8 PolyCode; // 1
u8 PolyTag; // 1
};
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
struct sTileMapElem
{
u16 Tile;
// u16 LightIdx;
};
2001-06-28 19:48:30 +02:00
struct sElem2d
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-06-28 19:48:30 +02:00
struct sElem3d
2001-04-07 23:05:33 +02:00
{
2001-06-28 19:48:30 +02:00
// 3d Elem (tile/model)
2001-04-19 01:04:03 +02:00
u16 TriStart;
u16 TriCount;
u16 QuadStart;
u16 QuadCount;
2001-07-12 22:10:15 +02:00
u16 VtxIdxStart;
u16 VtxTriCount;
2001-06-28 19:48:30 +02:00
}; // 12
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
{
2001-06-28 19:48:30 +02:00
u16 ElemID;
u16 Pad;
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
{
2001-06-28 19:48:30 +02:00
u32 BackLayer;
u32 MidLayer;
u32 ActionLayer;
u32 ForeLayer;
u32 CollisionLayer;
u32 ActorList;
u32 ItemList;
u32 PlatformList;
u32 TriggerList;
u32 FXList;
u32 HazardList;
u16 PlayerStartX,PlayerStartY;
sElem2d *ElemBank2d;
sElem3d *ElemBank3d;
sTri *TriList;
sQuad *QuadList;
sVtx *VtxList;
2001-07-12 22:10:15 +02:00
u16 *VtxIdxList;
2001-06-28 19:48:30 +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
{
2001-06-18 23:26:55 +02:00
u8 *PAKSpr; // 4 Needs to be u32, so might as well make it a ptr
s8 AspectX0,AspectX1; // 2 Aspect correction value
u8 W,H; // 2
2001-05-15 19:40:06 +02:00
};
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
//***************************************************************************
2001-06-18 23:26:55 +02:00
//*** FX Stuff **************************************************************
//***************************************************************************
#if 0
enum FX_FLAG
{
FX_FLAG_LOOP =1<<0,
FX_FLAG_COLLIDE_KILL =1<<1,
FX_FLAG_HAS_GRAVITY =1<<2,
FX_FLAG_INJURE_PLAYER =1<<3,
FX_FLAG_TRANS =1<<4,
};
//***************************************************************************
struct sFXData
{
s16 Scale;
// s16 StartFrame,EndFrame;
// s8 FrameShift;
// u8 R,G,B;
u16 Flags;
// DVECTOR Velocity;
u16 Velocity,Heading;
// u16 EndFX;
};
#endif
//***************************************************************************
2000-12-06 23:21:55 +01:00
#endif