/*************/ /*** Level ***/ /*************/ #include "system\global.h" #include "fileio\fileio.h" #include "utils\utils.h" #include "gfx\tpage.h" #include "gfx\prim.h" #include #include "level\level.h" #include "level\layer.h" #include "level\layertile.h" #include "pad\pads.h" /*****************************************************************************/ CLevel::CLevel() { for (int i=0; iTriList); sQuad *QuadList=(sQuad*)MakePtr(LevelHdr,LevelHdr->QuadList); sVtx *VtxList=(sVtx*)MakePtr(LevelHdr,LevelHdr->VtxList); sTile *TileList=(sTile*)MakePtr(LevelHdr,LevelHdr->TileList); // Back if (LevelHdr->BackLayer) { sLayerHdr *Layer=(sLayerHdr*)MakePtr(LevelHdr,LevelHdr->BackLayer); CLayer *NewLayer=new ("Back Layer") CLayerTile(Layer, TileList, TriList, QuadList, VtxList); NewLayer->init(); TileLayers[CLayer::LAYER_TYPE_TILE_BACK]=NewLayer; } // Mid if (LevelHdr->MidLayer) { sLayerHdr *Layer=(sLayerHdr*)MakePtr(LevelHdr,LevelHdr->MidLayer); CLayer *NewLayer=new ("Mid Layer") CLayerTile(Layer, TileList, TriList, QuadList, VtxList); NewLayer->init(); TileLayers[CLayer::LAYER_TYPE_TILE_MID]=NewLayer; } // Action if (LevelHdr->ActionLayer) { sLayerHdr *Layer=(sLayerHdr*)MakePtr(LevelHdr,LevelHdr->ActionLayer); CLayer *NewLayer=new ("Action Layer") CLayerTile(Layer, TileList, TriList, QuadList, VtxList); NewLayer->init(); TileLayers[CLayer::LAYER_TYPE_TILE_ACTION]=NewLayer; } // Fore if (LevelHdr->ForeLayer) { sLayerHdr *Layer=(sLayerHdr*)MakePtr(LevelHdr,LevelHdr->ForeLayer); CLayer *NewLayer=new ("Fore Layer") CLayerTile(Layer, TileList, TriList, QuadList, VtxList); NewLayer->init(); TileLayers[CLayer::LAYER_TYPE_TILE_FORE]=NewLayer; } } /*****************************************************************************/ void CLevel::shutdown() { MemFree(LevelHdr); } /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ void CLevel::render() { for (int i=0; irender(); } } /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ extern int MapX; extern int MapY; void CLevel::think(int _frames) { int padh = PadGetHeld( 0 ); if (padh & PAD_LEFT) MapX+=4; if (padh & PAD_RIGHT) MapX-=4; if (padh & PAD_UP) MapY+=4; if (padh & PAD_DOWN) MapY-=4; for (int i=0; ithink(_frames); } } /*****************************************************************************/