This commit is contained in:
Daveo 2001-02-20 19:17:03 +00:00
parent fbc10e79cd
commit 7346a7cc7d
6 changed files with 59 additions and 45 deletions

View File

@ -75,6 +75,7 @@ void CLayerShade::Load(CFile *File,int Version)
else else
{ {
File->Read(&Count,sizeof(int)); File->Read(&Count,sizeof(int));
if (Count<2) Count=2;
for (int i=0; i<LAYER_SHADE_RGB_MAX; i++) for (int i=0; i<LAYER_SHADE_RGB_MAX; i++)
{ {
File->Read(&Pos[i],sizeof(int)); File->Read(&Pos[i],sizeof(int));
@ -204,7 +205,9 @@ void CLayerShade::Export(CCore *Core,CExport &Exp)
for (int i=0; i<LAYER_SHADE_RGB_MAX; i++) for (int i=0; i<LAYER_SHADE_RGB_MAX; i++)
{ {
Exp.Write(&Pos[i],sizeof(int)); Exp.Write(&Pos[i],sizeof(int));
Exp.Write(&RGB[i],sizeof(RGBQUAD)); Exp.Write(&RGB[i].rgbRed,sizeof(u8));
Exp.Write(&RGB[i].rgbGreen,sizeof(u8));
Exp.Write(&RGB[i].rgbBlue,sizeof(u8));
Exp.Write(&RGB[i].rgbRed,sizeof(u8)); // Pad
} }
} }

View File

@ -15,24 +15,13 @@
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
CLayerBack::CLayerBack(sLayerHdr *Hdr,sTile *TileList,sTri *TriList,sQuad *QuadList,sVtx *VtxList) : CLayerTile(Hdr,TileList,TriList,QuadList,VtxList)// : CLayerTile(Hdr) CLayerBack::CLayerBack(sLayerHdr *Hdr,sTile *TileList,sTri *TriList,sQuad *QuadList,sVtx *VtxList) : CLayerTile(Hdr,TileList,TriList,QuadList,VtxList)
{ {
// RGB[0]=(u8*)MakePtr(Hdr,sizeof(sLayerHdr)); Data=(sLayerShadeHdr*)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; i<Data->Count; 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);
}
ASSERT(Data->Count<=LAYER_SHADE_RGB_MAX);
printf("%i Back Shades",Data->Count);
BandCount=Data->Count-1;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -46,6 +35,19 @@ CLayerBack::~CLayerBack()
/*****************************************************************************/ /*****************************************************************************/
void CLayerBack::init(DVECTOR &MapPos,int Shift,int Width,int Height) void CLayerBack::init(DVECTOR &MapPos,int Shift,int Width,int Height)
{ {
MapXYShift=Shift;
BandHeight=(Height*16)/(BandCount);
for (int i=0; i<BandCount; i++)
{
SetPolyG4(&Band[i]);
setRGB0(&Band[i],Data->Data[i+0].RGB[0],Data->Data[i+0].RGB[1],Data->Data[i+0].RGB[2]);
setRGB1(&Band[i],Data->Data[i+0].RGB[0],Data->Data[i+0].RGB[1],Data->Data[i+0].RGB[2]);
setRGB2(&Band[i],Data->Data[i+1].RGB[0],Data->Data[i+1].RGB[1],Data->Data[i+1].RGB[2]);
setRGB3(&Band[i],Data->Data[i+1].RGB[0],Data->Data[i+1].RGB[1],Data->Data[i+1].RGB[2]);
}
} }
/*****************************************************************************/ /*****************************************************************************/
@ -56,17 +58,21 @@ void CLayerBack::shutdown()
/*****************************************************************************/ /*****************************************************************************/
void CLayerBack::think(DVECTOR &MapPos) void CLayerBack::think(DVECTOR &MapPos)
{ {
YOfs=MapPos.vy>>2; YOfs=MapPos.vy>>MapXYShift;
} }
/*****************************************************************************/ /*****************************************************************************/
int BH=256;
void CLayerBack::render() void CLayerBack::render()
{ {
sOT *ThisOT=OtPtr+(MAX_OT-1); sOT *ThisOT=OtPtr+(MAX_OT-1);
//printf("%i %i\n",MapWidth,MapHeight); int ThisY=-YOfs;
setXYWH(&Poly[0],0,-YOfs,512,BH);
// addPrim(ThisOT,&Poly[0]); for (int i=0; i<BandCount; i++)
{
setXYWH(&Band[i],0,ThisY,512,BandHeight);
addPrim(ThisOT,&Band[i]);
ThisY+=BandHeight;
}
} }

View File

@ -19,10 +19,11 @@ public:
void render(); void render();
protected: protected:
// u8 *RGB[4];
sLayerShadeHdr *Data; sLayerShadeHdr *Data;
int YOfs; int YOfs;
POLY_G4 Poly[4]; int BandCount,BandHeight;
POLY_G4 Band[LAYER_SHADE_RGB_MAX-1];
}; };

View File

@ -49,34 +49,38 @@ sLvlTab LvlTable[]=
{LEVELS_CHAPTER04_LEVEL01_TBK,LEVELS_CHAPTER04_LEVEL0103_LVL,LEVELS_CHAPTER04_LEVEL01_TEX}, // 15 {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 {LEVELS_CHAPTER04_LEVEL01_TBK,LEVELS_CHAPTER04_LEVEL0104_LVL,LEVELS_CHAPTER04_LEVEL01_TEX}, // 16
// C4 L2 // C4 L2
{LEVELS_CHAPTER04_LEVEL02_TBK,LEVELS_CHAPTER04_LEVEL0201_LVL,LEVELS_CHAPTER04_LEVEL02_TEX}, // {LEVELS_CHAPTER04_LEVEL02_TBK,LEVELS_CHAPTER04_LEVEL0201_LVL,LEVELS_CHAPTER04_LEVEL02_TEX}, // 17
{LEVELS_CHAPTER04_LEVEL02_TBK,LEVELS_CHAPTER04_LEVEL0202_LVL,LEVELS_CHAPTER04_LEVEL02_TEX}, // {LEVELS_CHAPTER04_LEVEL02_TBK,LEVELS_CHAPTER04_LEVEL0202_LVL,LEVELS_CHAPTER04_LEVEL02_TEX}, // 18
{LEVELS_CHAPTER04_LEVEL02_TBK,LEVELS_CHAPTER04_LEVEL0203_LVL,LEVELS_CHAPTER04_LEVEL02_TEX}, // {LEVELS_CHAPTER04_LEVEL02_TBK,LEVELS_CHAPTER04_LEVEL0203_LVL,LEVELS_CHAPTER04_LEVEL02_TEX}, // 19
{LEVELS_CHAPTER04_LEVEL02_TBK,LEVELS_CHAPTER04_LEVEL0204_LVL,LEVELS_CHAPTER04_LEVEL02_TEX}, // {LEVELS_CHAPTER04_LEVEL02_TBK,LEVELS_CHAPTER04_LEVEL0204_LVL,LEVELS_CHAPTER04_LEVEL02_TEX}, // 20
// C4 L3 - 6 parts // C4 L3 - 6 parts
{LEVELS_CHAPTER04_LEVEL03_TBK,LEVELS_CHAPTER04_LEVEL0301_LVL,LEVELS_CHAPTER04_LEVEL03_TEX}, // 10 {LEVELS_CHAPTER04_LEVEL03_TBK,LEVELS_CHAPTER04_LEVEL0301_LVL,LEVELS_CHAPTER04_LEVEL03_TEX}, // 21
{LEVELS_CHAPTER04_LEVEL03_TBK,LEVELS_CHAPTER04_LEVEL0302_LVL,LEVELS_CHAPTER04_LEVEL03_TEX}, // 11 {LEVELS_CHAPTER04_LEVEL03_TBK,LEVELS_CHAPTER04_LEVEL0302_LVL,LEVELS_CHAPTER04_LEVEL03_TEX}, // 22
{LEVELS_CHAPTER04_LEVEL03_TBK,LEVELS_CHAPTER04_LEVEL0303_LVL,LEVELS_CHAPTER04_LEVEL03_TEX}, // 12 {LEVELS_CHAPTER04_LEVEL03_TBK,LEVELS_CHAPTER04_LEVEL0303_LVL,LEVELS_CHAPTER04_LEVEL03_TEX}, // 23
{LEVELS_CHAPTER04_LEVEL03_TBK,LEVELS_CHAPTER04_LEVEL0304_LVL,LEVELS_CHAPTER04_LEVEL03_TEX}, // 13 {LEVELS_CHAPTER04_LEVEL03_TBK,LEVELS_CHAPTER04_LEVEL0304_LVL,LEVELS_CHAPTER04_LEVEL03_TEX}, // 24
{LEVELS_CHAPTER04_LEVEL03_TBK,LEVELS_CHAPTER04_LEVEL0305_LVL,LEVELS_CHAPTER04_LEVEL03_TEX}, // 14 {LEVELS_CHAPTER04_LEVEL03_TBK,LEVELS_CHAPTER04_LEVEL0305_LVL,LEVELS_CHAPTER04_LEVEL03_TEX}, // 25
{LEVELS_CHAPTER04_LEVEL03_TBK,LEVELS_CHAPTER04_LEVEL0306_LVL,LEVELS_CHAPTER04_LEVEL03_TEX}, // 15 {LEVELS_CHAPTER04_LEVEL03_TBK,LEVELS_CHAPTER04_LEVEL0306_LVL,LEVELS_CHAPTER04_LEVEL03_TEX}, // 26
// C3 L4 - 7 parts // C3 L4 - 7 parts
{LEVELS_CHAPTER04_LEVEL04_TBK,LEVELS_CHAPTER04_LEVEL0401_LVL,LEVELS_CHAPTER04_LEVEL04_TEX}, // 16 {LEVELS_CHAPTER04_LEVEL04_TBK,LEVELS_CHAPTER04_LEVEL0401_LVL,LEVELS_CHAPTER04_LEVEL04_TEX}, // 27
{LEVELS_CHAPTER04_LEVEL04_TBK,LEVELS_CHAPTER04_LEVEL0402_LVL,LEVELS_CHAPTER04_LEVEL04_TEX}, // 17 {LEVELS_CHAPTER04_LEVEL04_TBK,LEVELS_CHAPTER04_LEVEL0402_LVL,LEVELS_CHAPTER04_LEVEL04_TEX}, // 28
{LEVELS_CHAPTER04_LEVEL04_TBK,LEVELS_CHAPTER04_LEVEL0403_LVL,LEVELS_CHAPTER04_LEVEL04_TEX}, // 18 {LEVELS_CHAPTER04_LEVEL04_TBK,LEVELS_CHAPTER04_LEVEL0403_LVL,LEVELS_CHAPTER04_LEVEL04_TEX}, // 29
{LEVELS_CHAPTER04_LEVEL04_TBK,LEVELS_CHAPTER04_LEVEL0404_LVL,LEVELS_CHAPTER04_LEVEL04_TEX}, // 19 {LEVELS_CHAPTER04_LEVEL04_TBK,LEVELS_CHAPTER04_LEVEL0404_LVL,LEVELS_CHAPTER04_LEVEL04_TEX}, // 30
{LEVELS_CHAPTER04_LEVEL04_TBK,LEVELS_CHAPTER04_LEVEL0405_LVL,LEVELS_CHAPTER04_LEVEL04_TEX}, // 20 {LEVELS_CHAPTER04_LEVEL04_TBK,LEVELS_CHAPTER04_LEVEL0405_LVL,LEVELS_CHAPTER04_LEVEL04_TEX}, // 31
{LEVELS_CHAPTER04_LEVEL04_TBK,LEVELS_CHAPTER04_LEVEL0406_LVL,LEVELS_CHAPTER04_LEVEL04_TEX}, // 21 {LEVELS_CHAPTER04_LEVEL04_TBK,LEVELS_CHAPTER04_LEVEL0406_LVL,LEVELS_CHAPTER04_LEVEL04_TEX}, // 32
{LEVELS_CHAPTER04_LEVEL04_TBK,LEVELS_CHAPTER04_LEVEL0407_LVL,LEVELS_CHAPTER04_LEVEL04_TEX}, // 22 {LEVELS_CHAPTER04_LEVEL04_TBK,LEVELS_CHAPTER04_LEVEL0407_LVL,LEVELS_CHAPTER04_LEVEL04_TEX}, // 33
}; };
extern int s_globalLevelSelectThing; extern int s_globalLevelSelectThing;
//int Lvl=13; #if defined(__USER_daveo__)
int Lvl=-1;
#endif
/*****************************************************************************/ /*****************************************************************************/
void CLevel::init() void CLevel::init()
{ {
// s_globalLevelSelectThing=Lvl; #if defined(__USER_daveo__)
if (Lvl>-1) s_globalLevelSelectThing=Lvl;
#endif
for (int i=0; i<CLayerTile::LAYER_TILE_TYPE_MAX; i++) for (int i=0; i<CLayerTile::LAYER_TILE_TYPE_MAX; i++)
{ {
TileLayers[i]=0; TileLayers[i]=0;

Binary file not shown.

Binary file not shown.