This commit is contained in:
parent
df0a744556
commit
80b14c0704
10 changed files with 71 additions and 64 deletions
|
@ -97,6 +97,7 @@ gui_src := gbubbles \
|
||||||
|
|
||||||
level_src := level \
|
level_src := level \
|
||||||
layertile \
|
layertile \
|
||||||
|
layerback \
|
||||||
layertilesolid \
|
layertilesolid \
|
||||||
layertile3d
|
layertile3d
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,9 @@ LEVELS_IN_DIR := $(GRAF_DIR)/levels
|
||||||
LEVELS_OUT_DIR := $(DATA_OUT)/levels
|
LEVELS_OUT_DIR := $(DATA_OUT)/levels
|
||||||
|
|
||||||
LEVELS_CHAPTERS := CHAPTER01 CHAPTER02 CHAPTER03 CHAPTER04 CHAPTER05
|
LEVELS_CHAPTERS := CHAPTER01 CHAPTER02 CHAPTER03 CHAPTER04 CHAPTER05
|
||||||
LEVELS_CHAPTER01 := LEVEL04
|
LEVELS_CHAPTER01 :=
|
||||||
LEVELS_CHAPTER02 :=
|
LEVELS_CHAPTER02 :=
|
||||||
LEVELS_CHAPTER03 :=
|
LEVELS_CHAPTER03 := LEVEL02
|
||||||
LEVELS_CHAPTER04 :=
|
LEVELS_CHAPTER04 :=
|
||||||
LEVELS_CHAPTER05 :=
|
LEVELS_CHAPTER05 :=
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,12 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int ZPos=6500;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
FontBank *CGameScene::s_genericFont;
|
FontBank *CGameScene::s_genericFont;
|
||||||
|
MATRIX CGameScene::CamMtx;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
@ -48,6 +51,9 @@ void CGameScene::init()
|
||||||
Player.init();
|
Player.init();
|
||||||
CAnimDB::LoadAnims();
|
CAnimDB::LoadAnims();
|
||||||
|
|
||||||
|
SetIdentNoTrans(&CamMtx);
|
||||||
|
CamMtx.t[2]=ZPos;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -62,6 +68,8 @@ void CGameScene::shutdown()
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CGameScene::render()
|
void CGameScene::render()
|
||||||
{
|
{
|
||||||
|
CamMtx.t[2]=ZPos; // Temp
|
||||||
|
|
||||||
m_conversation.render();
|
m_conversation.render();
|
||||||
Player.render();
|
Player.render();
|
||||||
Level.render();
|
Level.render();
|
||||||
|
|
|
@ -19,17 +19,18 @@ class FontBank;
|
||||||
class CGameScene : public CScene
|
class CGameScene : public CScene
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CGameScene() {;}
|
CGameScene() {;}
|
||||||
virtual ~CGameScene() {;}
|
virtual ~CGameScene() {;}
|
||||||
|
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
void render();
|
void render();
|
||||||
void think(int _frames);
|
void think(int _frames);
|
||||||
int readyToShutdown();
|
int readyToShutdown();
|
||||||
char *getSceneName() {return "Game";}
|
char *getSceneName() {return "Game";}
|
||||||
|
|
||||||
|
static MATRIX *GetCamMtx() {return(&CamMtx);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@ private:
|
||||||
CPlayer Player;
|
CPlayer Player;
|
||||||
CConversation m_conversation;
|
CConversation m_conversation;
|
||||||
static FontBank *s_genericFont;
|
static FontBank *s_genericFont;
|
||||||
|
static MATRIX CamMtx;
|
||||||
//static class SpriteBank *s_sprites; <-- Was causing compile error, sorry
|
//static class SpriteBank *s_sprites; <-- Was causing compile error, sorry
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,18 +9,18 @@
|
||||||
|
|
||||||
|
|
||||||
#include "LayerTile.h"
|
#include "LayerTile.h"
|
||||||
#include "LayerTileSolid.h"
|
#include "LayerBack.h"
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CLayerTileSolid::CLayerTileSolid(sLayerHdr *Hdr,sTile *TileList,sTri *TriList,sQuad *QuadList,sVtx *VtxList) : CLayerTile(Hdr,TileList,TriList,QuadList,VtxList)
|
CLayerBack::CLayerBack(sLayerHdr *Hdr,sTile *TileList,sTri *TriList,sQuad *QuadList,sVtx *VtxList) : CLayerTile(Hdr,TileList,TriList,QuadList,VtxList)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
CLayerTileSolid::~CLayerTileSolid()
|
CLayerBack::~CLayerBack()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,18 +28,18 @@ CLayerTileSolid::~CLayerTileSolid()
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTileSolid::init(DVECTOR &MapPos,int Shift,int Width,int Height)
|
void CLayerBack::init(DVECTOR &MapPos,int Shift,int Width,int Height)
|
||||||
{
|
|
||||||
CLayerTile::init(MapPos,Shift,MapWidth,MapHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void CLayerTileSolid::shutdown()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTileSolid::think(DVECTOR &MapPos)
|
void CLayerBack::shutdown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
int YY;
|
||||||
|
void CLayerBack::think(DVECTOR &MapPos)
|
||||||
{ // Overide default strip scroll update
|
{ // Overide default strip scroll update
|
||||||
int XPos=MapPos.vx>>MapXYShift;
|
int XPos=MapPos.vx>>MapXYShift;
|
||||||
int YPos=MapPos.vy>>MapXYShift;
|
int YPos=MapPos.vy>>MapXYShift;
|
||||||
|
@ -49,36 +49,27 @@ int YPos=MapPos.vy>>MapXYShift;
|
||||||
|
|
||||||
MapX=XPos>>4;
|
MapX=XPos>>4;
|
||||||
MapY=YPos>>4;
|
MapY=YPos>>4;
|
||||||
|
|
||||||
|
YY=MapPos.vy>>2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CLayerTileSolid::render()
|
void CLayerBack::render()
|
||||||
{
|
{
|
||||||
sPrimGridElem *Grid=GetGridPos(MapX,MapY);
|
POLY_G4 *G4;
|
||||||
s16 TileX,TileY;
|
sOT *ThisOT=OtPtr+LayerOT;
|
||||||
sOT *ThisOT=OtPtr+LayerOT;
|
int Col;
|
||||||
|
|
||||||
// Setup shift bits of pos
|
Col=YY;
|
||||||
TileY=-ShiftY;
|
if (Col>127) Col=127;
|
||||||
|
|
||||||
// Render it!!
|
G4=GetPrimG4();
|
||||||
for (int Y=0; Y<SCREEN_TILE_HEIGHT; Y++)
|
setXYWH(G4,0,0,512,256);
|
||||||
{
|
setRGB0(G4,0,255-Col,255-Col);
|
||||||
sPrimGridElem *GridDown= Grid->Down;
|
setRGB1(G4,0,255-Col,255-Col);
|
||||||
TileX=-ShiftX;
|
setRGB2(G4,0,0,128-Col);
|
||||||
|
setRGB3(G4,0,0,128-Col);
|
||||||
for (int X=0; X<SCREEN_TILE_WIDTH; X++)
|
addPrimNoCheck(ThisOT,G4);
|
||||||
{
|
|
||||||
TSPRT_16 *Prim=&Grid->Prim;
|
|
||||||
/**/ Prim->x0=TileX;
|
|
||||||
/**/ Prim->y0=TileY;
|
|
||||||
addPrimNoCheck(ThisOT,Prim);
|
|
||||||
Grid=Grid->Right;
|
|
||||||
TileX+=TILE_WIDTH;
|
|
||||||
}
|
|
||||||
Grid=GridDown;
|
|
||||||
TileY+=TILE_HEIGHT;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,7 @@ void CLayerTile::render()
|
||||||
{
|
{
|
||||||
sPrimGridElem *Grid=GetGridPos(MapX,MapY);
|
sPrimGridElem *Grid=GetGridPos(MapX,MapY);
|
||||||
s16 TileX,TileY;
|
s16 TileX,TileY;
|
||||||
|
sOT *ThisOT=OtPtr+LayerOT;
|
||||||
// Setup shift bits of pos
|
// Setup shift bits of pos
|
||||||
TileY=-ShiftY;
|
TileY=-ShiftY;
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ s16 TileX,TileY;
|
||||||
{
|
{
|
||||||
/**/ Prim->x0=TileX;
|
/**/ Prim->x0=TileX;
|
||||||
/**/ Prim->y0=TileY;
|
/**/ Prim->y0=TileY;
|
||||||
addPrimNoCheck(OtPtr,Prim);
|
addPrimNoCheck(ThisOT,Prim);
|
||||||
}
|
}
|
||||||
Grid=Grid->Right;
|
Grid=Grid->Right;
|
||||||
TileX+=TILE_WIDTH;
|
TileX+=TILE_WIDTH;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#ifndef __LAYER_TILE_H__
|
#ifndef __LAYER_TILE_H__
|
||||||
#define __LAYER_TILE_H__
|
#define __LAYER_TILE_H__
|
||||||
|
|
||||||
|
#include "gfx\prim.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
struct sPrimGridElem
|
struct sPrimGridElem
|
||||||
|
@ -20,6 +21,9 @@ struct sPrimGridElem3d : public sPrimGridElem
|
||||||
u16 Flags;
|
u16 Flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
const s32 LayerOT=MAX_OT-1;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
class CLayerTile
|
class CLayerTile
|
||||||
{
|
{
|
||||||
|
|
|
@ -151,6 +151,7 @@ sPrimGridElem3d *Grid=GetGridPos3d(MapX,MapY);
|
||||||
s16 TileX,TileY;
|
s16 TileX,TileY;
|
||||||
VECTOR BlkPos;
|
VECTOR BlkPos;
|
||||||
s32 BlkXStore;
|
s32 BlkXStore;
|
||||||
|
sOT *ThisOT=OtPtr+LayerOT;
|
||||||
|
|
||||||
// Setup shift bits of pos
|
// Setup shift bits of pos
|
||||||
TileY=-ShiftY;
|
TileY=-ShiftY;
|
||||||
|
@ -171,7 +172,7 @@ s32 BlkXStore;
|
||||||
{ // Has 2d Data
|
{ // Has 2d Data
|
||||||
/**/ Prim->x0=TileX;
|
/**/ Prim->x0=TileX;
|
||||||
/**/ Prim->y0=TileY;
|
/**/ Prim->y0=TileY;
|
||||||
addPrimNoCheck(OtPtr,Prim);
|
addPrimNoCheck(ThisOT,Prim);
|
||||||
}
|
}
|
||||||
if (Grid->Flags)
|
if (Grid->Flags)
|
||||||
{ // Has 3d Data
|
{ // Has 3d Data
|
||||||
|
@ -204,6 +205,7 @@ POLY_FT3 *TPrimPtr=(POLY_FT3*)GetPrimPtr();
|
||||||
u16 *TileTable=Tile->TileTable;
|
u16 *TileTable=Tile->TileTable;
|
||||||
u32 T0,T1,T2;
|
u32 T0,T1,T2;
|
||||||
sTri *TList=TriList+Tile->TriStart;
|
sTri *TList=TriList+Tile->TriStart;
|
||||||
|
sOT *ThisOT=OtPtr+LayerOT;
|
||||||
|
|
||||||
//--- Tris ---------------------------------------------------------------------------
|
//--- Tris ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -230,7 +232,7 @@ sTri *TList=TriList+Tile->TriStart;
|
||||||
*(u16*)&TPrimPtr->u2=T2; // Set UV2
|
*(u16*)&TPrimPtr->u2=T2; // Set UV2
|
||||||
|
|
||||||
TList++;
|
TList++;
|
||||||
addPrimNoCheck(OtPtr,TPrimPtr);
|
addPrimNoCheck(ThisOT,TPrimPtr);
|
||||||
gte_stsxy3_ft3(TPrimPtr);
|
gte_stsxy3_ft3(TPrimPtr);
|
||||||
TPrimPtr++;
|
TPrimPtr++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,11 @@
|
||||||
#include "gfx\tpage.h"
|
#include "gfx\tpage.h"
|
||||||
#include "gfx\prim.h"
|
#include "gfx\prim.h"
|
||||||
#include <DStructs.h>
|
#include <DStructs.h>
|
||||||
|
#include "game\game.h"
|
||||||
|
|
||||||
#include "level\level.h"
|
#include "level\level.h"
|
||||||
#include "level\layertile.h"
|
#include "level\layertile.h"
|
||||||
|
#include "level\layerback.h"
|
||||||
#include "level\layertilesolid.h"
|
#include "level\layertilesolid.h"
|
||||||
#include "level\layertile3d.h"
|
#include "level\layertile3d.h"
|
||||||
|
|
||||||
|
@ -38,12 +40,10 @@ CLevel::~CLevel()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
int ZPos=6500;
|
|
||||||
|
|
||||||
void CLevel::init()
|
void CLevel::init()
|
||||||
{
|
{
|
||||||
LevelHdr=(sLvlHdr *)CFileIO::loadFile(LEVEL04_LEVEL04_LVL,"Level Data");
|
LevelHdr=(sLvlHdr *)CFileIO::loadFile(LEVEL02_LEVEL02_LVL,"Level Data");
|
||||||
TPLoadTex(LEVEL04_LEVEL04_TEX);
|
TPLoadTex(LEVEL02_LEVEL02_TEX);
|
||||||
|
|
||||||
initLayers();
|
initLayers();
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,8 @@ sTile *TileList=(sTile*)MakePtr(LevelHdr,LevelHdr->TileList);
|
||||||
if (LevelHdr->BackLayer)
|
if (LevelHdr->BackLayer)
|
||||||
{
|
{
|
||||||
sLayerHdr *Layer=(sLayerHdr*)MakePtr(LevelHdr,LevelHdr->BackLayer);
|
sLayerHdr *Layer=(sLayerHdr*)MakePtr(LevelHdr,LevelHdr->BackLayer);
|
||||||
CLayerTile *NewLayer=new ("Back Layer") CLayerTileSolid(Layer, TileList, TriList, QuadList, VtxList);
|
// CLayerTile *NewLayer=new ("Back Layer") CLayerTileSolid(Layer, TileList, TriList, QuadList, VtxList);
|
||||||
|
CLayerTile *NewLayer=new ("Back Layer") CLayerBack(Layer, TileList, TriList, QuadList, VtxList);
|
||||||
NewLayer->init(MapPos,3);
|
NewLayer->init(MapPos,3);
|
||||||
TileLayers[CLayerTile::LAYER_TILE_TYPE_BACK]=NewLayer;
|
TileLayers[CLayerTile::LAYER_TILE_TYPE_BACK]=NewLayer;
|
||||||
}
|
}
|
||||||
|
@ -107,20 +108,18 @@ void CLevel::shutdown()
|
||||||
void CLevel::render()
|
void CLevel::render()
|
||||||
{
|
{
|
||||||
// Setup Constant Rot Matrix
|
// Setup Constant Rot Matrix
|
||||||
MATRIX Mtx;
|
MATRIX *Mtx=CGameScene::GetCamMtx();
|
||||||
|
|
||||||
SetIdent(&Mtx);
|
SetRotMatrix(Mtx);
|
||||||
Mtx.t[2]=ZPos;
|
SetTransMatrix(Mtx);
|
||||||
SetRotMatrix(&Mtx);
|
|
||||||
SetTransMatrix(&Mtx);
|
|
||||||
|
|
||||||
// Setup dummy prim to ensure OtPos 0 is initialised (for fast add)
|
// Setup dummy prim to ensure OtPos 0 is initialised (for fast add)
|
||||||
TILE_16 *Prim=GetPrimTILE16();
|
TILE_16 *Prim=GetPrimTILE16();
|
||||||
|
sOT *ThisOT=OtPtr+LayerOT;
|
||||||
Prim->x0=1024;
|
Prim->x0=1024;
|
||||||
Prim->y0=1024;
|
Prim->y0=1024;
|
||||||
AddPrim(OtPtr,Prim);
|
AddPrim(ThisOT,Prim);
|
||||||
ASSERT(OtPtr->FirstPrim);
|
ASSERT(ThisOT->FirstPrim);
|
||||||
|
|
||||||
for (int i=0; i<CLayerTile::LAYER_TILE_TYPE_MAX; i++)
|
for (int i=0; i<CLayerTile::LAYER_TILE_TYPE_MAX; i++)
|
||||||
{
|
{
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Reference in a new issue