SBSPSS/tools/Data/include/dstructs.h

335 lines
7.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-02-20 16:56:16 +01:00
//***************************************************************************
// Taken from Map editor layerdef.h
enum PSX_COLLSION_ENUM
{
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_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,
2001-02-20 18:21:46 +01:00
COLLISION_TYPE_MASK = (0xff << COLLISION_TYPE_FLAG_SHIFT)&0xff,
COLLISION_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
{
s16 XMin,YMin,ZMin;
s16 XMax,YMax,ZMax;
};
//***************************************************************************
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-01-30 18:25:20 +01:00
u16 TPage; // 2 (Or material)
2000-12-06 23:21:55 +01:00
u8 uv2[2]; // 2
2000-12-14 17:38:34 +01:00
u16 P2; // 2
2000-12-12 21:56:51 +01:00
}; // 16
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-01-30 18:25:20 +01:00
u16 TPage; // 2 (Or material)
2000-12-06 23:21:55 +01:00
u8 uv2[2]; // 2
u8 uv3[2]; // 2
}; // 20
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
typedef u16 sTileMapElem; // Tile or Tri Start
struct sTile
{
// 2d Tile
u8 u0,v0; // 2
u16 Clut; // 2
u16 TPage; // 2
u16 Pad; // :o( need this? // 2
}; // 8
//---------------------------------------------------------------------------
struct sTileTri
{
u16 P0; // 2
u16 P1; // 2
u16 P2; // 2
u16 Mat; // 2
}; // 8
//---------------------------------------------------------------------------
struct sTileTriMat
{
u8 uv0[2]; // 2
u16 Clut; // 2
u8 uv1[2]; // 2
u16 TPage; // 2
u8 uv2[2]; // 2
}; // 10
//---------------------------------------------------------------------------
struct sTileQuad
{
u16 P0; // 2
u16 P1; // 2
u16 P2; // 2
u16 P3; // 2
u16 Mat; // 2
}; // 10
//---------------------------------------------------------------------------
struct sTileQuadMat
{
u8 uv0[2]; // 2
u16 Clut; // 2
u8 uv1[2]; // 2
u16 TPage; // 2
u8 uv2[2]; // 2
u8 uv3[2]; // 2
}; // 12
2000-12-06 23:21:55 +01:00
//***************************************************************************
2001-04-03 23:38:31 +02:00
// Level Info
2001-04-07 23:05:33 +02:00
2001-04-03 23:38:31 +02:00
struct sLevelInfo
{
u32 MaxPakSize;
u32 MaxLvlSize;
u16 ActorCount;
u16 Pad;
// u16 ActorTypeList.....
};
2000-12-12 21:56:51 +01:00
//---------------------------------------------------------------------------
// Layers
struct sLayerHdr
{
int Type;
int SubType;
int Width;
int Height;
/*int TileData[W][H];....*/
};
2001-03-08 00:20:09 +01:00
//---------------------------------------------------------------------------
struct sLayer3d
{
u16 TriCount;
u16 QuadCount;
u16 VtxCount;
u16 Pad;
u32 TriList;
u32 QuadList;
u32 VtxList;
};
2001-02-20 16:56:16 +01:00
//---------------------------------------------------------------------------
// Shade Layer
struct sLayerShade
{
u32 Ofs;
u8 RGB[4];
};
2001-04-07 23:05:33 +02:00
struct sLayerShadeGfx
{
u16 TPage;
u16 Clut;
u8 U,V;
u8 W,H;
u16 Flags;
};
2001-02-20 16:56:16 +01:00
struct sLayerShadeHdr
{
u16 Count;
2001-04-07 23:05:33 +02:00
sLayerShade Data[LAYER_SHADE_RGB_MAX];
sLayerShadeGfx BackGfx[2];
2001-02-20 16:56:16 +01:00
};
2000-12-12 21:56:51 +01:00
//---------------------------------------------------------------------------
// Header
struct sLvlHdr
{
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;
2000-12-12 21:56:51 +01:00
u32 Pad6;
u32 Pad7;
2001-04-07 23:05:33 +02:00
u16 PlayerStartX,PlayerStartY;
2000-12-06 23:21:55 +01:00
};
2001-01-08 22:33:31 +01:00
//***************************************************************************
//***************************************************************************
//***************************************************************************
// Actors
2001-04-01 22:22:49 +02:00
struct sSpriteFrame
{
u8 *PAKSpr; // 4
s8 XOfs,YOfs; // 2
u8 W,H; // 2
};
2001-01-08 22:33:31 +01:00
2001-04-01 22:22:49 +02:00
struct sSpriteAnim
{
u16 FrameCount; // 2
2001-04-02 20:25:09 +02:00
u16 Pad;
u16 *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-04-01 22:22:49 +02:00
u16 ColorCount; // 2
u16 AnimCount; // 2
u16 FrameCount; // 2
2001-04-09 23:27:21 +02:00
u16 MaxW,MaxH; // 4
u16 Pad;
2001-04-01 22:22:49 +02:00
u8 *Palette; // 4
sSpriteAnim *AnimList; // 4
sSpriteFrame *FrameList; // 4
};
//***************************************************************************
//***************************************************************************
//***************************************************************************
// Things - Must be 4 byte aligned for pos data
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-04-01 22:22:49 +02:00
u16 Type;
u16 Health;
u16 AttackStrength;
u16 Speed;
u16 TurnRate;
u8 Flags;
u8 PointCount;
// 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
{
u16 Type;
u16 Speed;
u16 TurnRate;
u8 Flags;
u8 PointCount;
// 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;
sThingPoint Pos,Size;
}; // 8
struct sThingTrigger
{
u16 Type;
sThingPoint Pos;
u8 Width,Height;
}; // 8
2001-04-01 22:22:49 +02:00
//***************************************************************************
2000-12-06 23:21:55 +01:00
#endif