diff --git a/source/level/layerback.cpp b/source/level/layerback.cpp index e4e8a4069..84f84f2c6 100644 --- a/source/level/layerback.cpp +++ b/source/level/layerback.cpp @@ -15,8 +15,24 @@ /*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ -CLayerBack::CLayerBack(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)// : CLayerTile(Hdr) { +// RGB[0]=(u8*)MakePtr(Hdr,sizeof(sLayerHdr)); +// RGB[1]=(u8*)MakePtr(RGB[0],3); +// RGB[2]=(u8*)MakePtr(RGB[1],3); +// RGB[3]=(u8*)MakePtr(RGB[2],3); + Data=(sLayerShadeHdr*)(Hdr,sizeof(sLayerHdr)); + + for (int i=0; iCount; i++) + { + SetPolyG4(&Poly[i]); + setRGB0(&Poly[i],Data->Data[i].RGB[0],Data->Data[i].RGB[1],Data->Data[i].RGB[2]); + setRGB1(&Poly[i],Data->Data[i].RGB[0],Data->Data[i].RGB[1],Data->Data[i].RGB[2]); +// setRGB2(G4,0,0,128-Col); +// setRGB3(G4,0,0,128-Col); + + } + } /*****************************************************************************/ @@ -38,38 +54,20 @@ 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; - - ShiftX=XPos&15; - ShiftY=YPos&15; - - MapX=XPos>>4; - MapY=YPos>>4; - - YY=MapPos.vy>>2; +{ + YOfs=MapPos.vy>>2; } /*****************************************************************************/ +int BH=256; void CLayerBack::render() { -POLY_G4 *G4; -sOT *ThisOT=OtPtr+LayerOT; -int Col; +sOT *ThisOT=OtPtr+(MAX_OT-1); +//printf("%i %i\n",MapWidth,MapHeight); + setXYWH(&Poly[0],0,-YOfs,512,BH); + addPrim(ThisOT,&Poly[0]); - Col=YY; - if (Col>127) Col=127; - - 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); } diff --git a/source/level/layerback.h b/source/level/layerback.h index dfbe93339..9df6bfec8 100644 --- a/source/level/layerback.h +++ b/source/level/layerback.h @@ -19,6 +19,10 @@ public: void render(); protected: +// u8 *RGB[4]; + sLayerShadeHdr *Data; + int YOfs; + POLY_G4 Poly[4]; }; diff --git a/source/level/layertile.cpp b/source/level/layertile.cpp index ecfa33e79..1b726df67 100644 --- a/source/level/layertile.cpp +++ b/source/level/layertile.cpp @@ -22,13 +22,14 @@ const u32 YInc=16<<16; CLayerTile::CLayerTile(sLayerHdr *Hdr,sTile *_TileList,sTri *_TriList,sQuad *_QuadList,sVtx *_VtxList) { LayerHdr=Hdr; + MapWidth=LayerHdr->Width; + MapHeight=LayerHdr->Height; + TileList=_TileList; TriList=_TriList; QuadList=_QuadList; VtxList=_VtxList; Map=(sTileMapElem*)MakePtr(Hdr,sizeof(sLayerHdr)); - MapWidth=LayerHdr->Width; - MapHeight=LayerHdr->Height; PrimGrid=0; } diff --git a/source/level/layertile.h b/source/level/layertile.h index c9b599a9c..4f8fd448d 100644 --- a/source/level/layertile.h +++ b/source/level/layertile.h @@ -48,7 +48,6 @@ public: SCREEN_TILE_SIZE=SCREEN_TILE_WIDTH*SCREEN_TILE_HEIGHT }; - CLayerTile(sLayerHdr *Hdr,sTile *TileList,sTri *TriList,sQuad *QuadList,sVtx *VtxList); virtual ~CLayerTile(); diff --git a/source/level/level.cpp b/source/level/level.cpp index 0c6ad6497..4a7516218 100644 --- a/source/level/level.cpp +++ b/source/level/level.cpp @@ -36,23 +36,23 @@ sLvlTab LvlTable[]= {LEVELS_CHAPTER03_LEVEL03_TBK,LEVELS_CHAPTER03_LEVEL0305_LVL,LEVELS_CHAPTER03_LEVEL03_TEX}, // 4 {LEVELS_CHAPTER03_LEVEL03_TBK,LEVELS_CHAPTER03_LEVEL0306_LVL,LEVELS_CHAPTER03_LEVEL03_TEX}, // 5 // C3 L4 - {LEVELS_CHAPTER03_LEVEL04_TBK,LEVELS_CHAPTER03_LEVEL0401_LVL,LEVELS_CHAPTER03_LEVEL04_TEX}, // - {LEVELS_CHAPTER03_LEVEL04_TBK,LEVELS_CHAPTER03_LEVEL0402_LVL,LEVELS_CHAPTER03_LEVEL04_TEX}, // - {LEVELS_CHAPTER03_LEVEL04_TBK,LEVELS_CHAPTER03_LEVEL0403_LVL,LEVELS_CHAPTER03_LEVEL04_TEX}, // - {LEVELS_CHAPTER03_LEVEL04_TBK,LEVELS_CHAPTER03_LEVEL0404_LVL,LEVELS_CHAPTER03_LEVEL04_TEX}, // - {LEVELS_CHAPTER03_LEVEL04_TBK,LEVELS_CHAPTER03_LEVEL0404X_LVL,LEVELS_CHAPTER03_LEVEL04_TEX}, // - {LEVELS_CHAPTER03_LEVEL04_TBK,LEVELS_CHAPTER03_LEVEL0405_LVL,LEVELS_CHAPTER03_LEVEL04_TEX}, // - {LEVELS_CHAPTER03_LEVEL04_TBK,LEVELS_CHAPTER03_LEVEL0406_LVL,LEVELS_CHAPTER03_LEVEL04_TEX}, // + {LEVELS_CHAPTER03_LEVEL04_TBK,LEVELS_CHAPTER03_LEVEL0401_LVL,LEVELS_CHAPTER03_LEVEL04_TEX}, // 6 + {LEVELS_CHAPTER03_LEVEL04_TBK,LEVELS_CHAPTER03_LEVEL0402_LVL,LEVELS_CHAPTER03_LEVEL04_TEX}, // 7 + {LEVELS_CHAPTER03_LEVEL04_TBK,LEVELS_CHAPTER03_LEVEL0403_LVL,LEVELS_CHAPTER03_LEVEL04_TEX}, // 8 + {LEVELS_CHAPTER03_LEVEL04_TBK,LEVELS_CHAPTER03_LEVEL0404_LVL,LEVELS_CHAPTER03_LEVEL04_TEX}, // 9 + {LEVELS_CHAPTER03_LEVEL04_TBK,LEVELS_CHAPTER03_LEVEL0404X_LVL,LEVELS_CHAPTER03_LEVEL04_TEX}, // 10 + {LEVELS_CHAPTER03_LEVEL04_TBK,LEVELS_CHAPTER03_LEVEL0405_LVL,LEVELS_CHAPTER03_LEVEL04_TEX}, // 11 + {LEVELS_CHAPTER03_LEVEL04_TBK,LEVELS_CHAPTER03_LEVEL0406_LVL,LEVELS_CHAPTER03_LEVEL04_TEX}, // 12 // C4 L1 - {LEVELS_CHAPTER04_LEVEL01_TBK,LEVELS_CHAPTER04_LEVEL0101_LVL,LEVELS_CHAPTER04_LEVEL01_TEX}, // - {LEVELS_CHAPTER04_LEVEL01_TBK,LEVELS_CHAPTER04_LEVEL0102_LVL,LEVELS_CHAPTER04_LEVEL01_TEX}, // - {LEVELS_CHAPTER04_LEVEL01_TBK,LEVELS_CHAPTER04_LEVEL0103_LVL,LEVELS_CHAPTER04_LEVEL01_TEX}, // - {LEVELS_CHAPTER04_LEVEL01_TBK,LEVELS_CHAPTER04_LEVEL0104_LVL,LEVELS_CHAPTER04_LEVEL01_TEX}, // + {LEVELS_CHAPTER04_LEVEL01_TBK,LEVELS_CHAPTER04_LEVEL0101_LVL,LEVELS_CHAPTER04_LEVEL01_TEX}, // 13 + {LEVELS_CHAPTER04_LEVEL01_TBK,LEVELS_CHAPTER04_LEVEL0102_LVL,LEVELS_CHAPTER04_LEVEL01_TEX}, // 14 + {LEVELS_CHAPTER04_LEVEL01_TBK,LEVELS_CHAPTER04_LEVEL0103_LVL,LEVELS_CHAPTER04_LEVEL01_TEX}, // 15 + {LEVELS_CHAPTER04_LEVEL01_TBK,LEVELS_CHAPTER04_LEVEL0104_LVL,LEVELS_CHAPTER04_LEVEL01_TEX}, // 16 // C4 L2 - {LEVELS_CHAPTER04_LEVEL02_TBK,LEVELS_CHAPTER04_LEVEL0201_LVL,LEVELS_CHAPTER04_LEVEL02_TEX}, // 6 - {LEVELS_CHAPTER04_LEVEL02_TBK,LEVELS_CHAPTER04_LEVEL0202_LVL,LEVELS_CHAPTER04_LEVEL02_TEX}, // 7 - {LEVELS_CHAPTER04_LEVEL02_TBK,LEVELS_CHAPTER04_LEVEL0203_LVL,LEVELS_CHAPTER04_LEVEL02_TEX}, // 8 - {LEVELS_CHAPTER04_LEVEL02_TBK,LEVELS_CHAPTER04_LEVEL0204_LVL,LEVELS_CHAPTER04_LEVEL02_TEX}, // 9 + {LEVELS_CHAPTER04_LEVEL02_TBK,LEVELS_CHAPTER04_LEVEL0201_LVL,LEVELS_CHAPTER04_LEVEL02_TEX}, // + {LEVELS_CHAPTER04_LEVEL02_TBK,LEVELS_CHAPTER04_LEVEL0202_LVL,LEVELS_CHAPTER04_LEVEL02_TEX}, // + {LEVELS_CHAPTER04_LEVEL02_TBK,LEVELS_CHAPTER04_LEVEL0203_LVL,LEVELS_CHAPTER04_LEVEL02_TEX}, // + {LEVELS_CHAPTER04_LEVEL02_TBK,LEVELS_CHAPTER04_LEVEL0204_LVL,LEVELS_CHAPTER04_LEVEL02_TEX}, // // C4 L3 - 6 parts {LEVELS_CHAPTER04_LEVEL03_TBK,LEVELS_CHAPTER04_LEVEL0301_LVL,LEVELS_CHAPTER04_LEVEL03_TEX}, // 10 {LEVELS_CHAPTER04_LEVEL03_TBK,LEVELS_CHAPTER04_LEVEL0302_LVL,LEVELS_CHAPTER04_LEVEL03_TEX}, // 11 @@ -72,9 +72,11 @@ sLvlTab LvlTable[]= }; extern int s_globalLevelSelectThing; +int Lvl=13; /*****************************************************************************/ void CLevel::init() { + s_globalLevelSelectThing=Lvl; for (int i=0; iVtxList); sTile *TileList=(sTile*)MakePtr(TileBankHdr,TileBankHdr->TileList); // Back -// if (LevelHdr->BackLayer) + + 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") CLayerBack(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; } @@ -128,7 +130,6 @@ sTile *TileList=(sTile*)MakePtr(TileBankHdr,TileBankHdr->TileList); NewLayer->init(MapPos,0); TileLayers[CLayerTile::LAYER_TILE_TYPE_ACTION]=NewLayer; } - /* // Fore if (LevelHdr->ForeLayer) diff --git a/tools/Data/bin/MkLevel.exe b/tools/Data/bin/MkLevel.exe index 2e8e180f4..a88f48143 100644 Binary files a/tools/Data/bin/MkLevel.exe and b/tools/Data/bin/MkLevel.exe differ diff --git a/tools/Data/include/dstructs.h b/tools/Data/include/dstructs.h index 8e67fef6f..13c6d23ef 100644 --- a/tools/Data/include/dstructs.h +++ b/tools/Data/include/dstructs.h @@ -5,6 +5,34 @@ #ifndef __DATA_STRUCTS_HEADER__ #define __DATA_STRUCTS_HEADER__ +//*************************************************************************** +// 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, + + COLLISION_TYPE_MASK = 255 << COLLISION_TYPE_FLAG_SHIFT, + COLLISION_MASK = (255-COLLISION_TYPE_MASK) + +}; +enum PSX_DATA_ENUM +{ + LAYER_SHADE_RGB_MAX=4, +}; + //*************************************************************************** // biped bone IDs /* @@ -209,6 +237,19 @@ struct sLayerHdr /*int TileData[W][H];....*/ }; +//--------------------------------------------------------------------------- +// Shade Layer +struct sLayerShade +{ + u32 Ofs; + u8 RGB[4]; +}; +struct sLayerShadeHdr +{ + u16 Count; + sLayerShade Data[4]; +}; + //--------------------------------------------------------------------------- // Header struct sLvlHdr diff --git a/tools/MapEdit/MapEdit.exe b/tools/MapEdit/MapEdit.exe index 5c912a2dc..ae291d0d2 100644 Binary files a/tools/MapEdit/MapEdit.exe and b/tools/MapEdit/MapEdit.exe differ