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