This commit is contained in:
parent
6f1def2d0a
commit
e59981cf94
18 changed files with 139 additions and 87 deletions
|
@ -142,6 +142,53 @@ int i,ListSize;
|
|||
//***************************************************************************
|
||||
//***************************************************************************
|
||||
//***************************************************************************
|
||||
#if 1
|
||||
void PakImage(sBmp &Image)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
const char *ExeName="tools\\lznp";
|
||||
#else
|
||||
const char *ExeName="lznp.exe";
|
||||
#endif
|
||||
const char *TmpName="Actor.Tmp";
|
||||
const char *PakName="Actor.Pak";
|
||||
char CmdStr[256];
|
||||
FILE *File;
|
||||
|
||||
// Write normal file to temp
|
||||
File=fopen(TmpName,"wb");
|
||||
if (!File) GObject::Error(ERR_FATAL,"Could not create temp file %s.",TmpName);
|
||||
fwrite(Image.Psx,1,Image.PsxSize,File);
|
||||
fclose(File);
|
||||
|
||||
// Pak File by calling LZNP.exe
|
||||
sprintf(CmdStr, "%s %s %s >nul",ExeName,TmpName, PakName);
|
||||
system(CmdStr);
|
||||
|
||||
// Read Pak File Back
|
||||
remove(TmpName); // Delete Tmp File
|
||||
File=fopen(PakName,"rb");
|
||||
if (!File) GObject::Error(ERR_FATAL,"Could not open temp Pak file %s.",PakName);
|
||||
fseek(File,0,SEEK_END);
|
||||
Image.PakSize=ftell(File);
|
||||
fseek(File,0,SEEK_SET);
|
||||
Image.Pak=(u8*)malloc(Image.PakSize*2);
|
||||
ASSERT(Image.Pak);
|
||||
fread(Image.Pak,1,Image.PakSize,File);
|
||||
fclose(File);
|
||||
remove(PakName); // Delete Pak File
|
||||
|
||||
}
|
||||
#else
|
||||
void PakImage(sBmp &Image)
|
||||
{
|
||||
Image.PakSize=PAK_findPakSize(Image.Psx,Image.PsxSize);
|
||||
Image.Pak=(u8*)malloc(Image.PakSize);
|
||||
ASSERT(Image.Pak);
|
||||
PAK_doPak(Image.Pak,Image.Psx,Image.PsxSize);
|
||||
}
|
||||
#endif
|
||||
//***************************************************************************
|
||||
CMkActor::CMkActor(GString &ActorName,GString &ActorPath,GString &SpritePath)
|
||||
{
|
||||
Name=ActorName;
|
||||
|
@ -543,13 +590,14 @@ int i,ListSize=BmpList.size();
|
|||
{
|
||||
sBmp &ThisBmp=BmpList[i];
|
||||
|
||||
printf("%s - Processing Frame %2d\\%2d\r",Name,i+1,ListSize);
|
||||
printf("%s - Processing Frame %2d\\%2d\t\t\t\r",Name,i+1,ListSize);
|
||||
if (ThisBmp.Psx)
|
||||
{
|
||||
ThisBmp.PakSize=PAK_findPakSize(ThisBmp.Psx,ThisBmp.PsxSize);
|
||||
ThisBmp.Pak=(u8*)malloc(ThisBmp.PakSize);
|
||||
ASSERT(ThisBmp.Pak);
|
||||
PAK_doPak(ThisBmp.Pak,ThisBmp.Psx,ThisBmp.PsxSize);
|
||||
PakImage(ThisBmp);
|
||||
// ThisBmp.PakSize=PAK_findPakSize(ThisBmp.Psx,ThisBmp.PsxSize);
|
||||
// ThisBmp.Pak=(u8*)malloc(ThisBmp.PakSize);
|
||||
// ASSERT(ThisBmp.Pak);
|
||||
// PAK_doPak(ThisBmp.Pak,ThisBmp.Psx,ThisBmp.PsxSize);
|
||||
}
|
||||
else
|
||||
{ // Blank Frame
|
||||
|
|
|
@ -358,7 +358,7 @@ triggers_src := trigger \
|
|||
|
||||
utils_src := utils \
|
||||
sincos \
|
||||
pak
|
||||
lznp
|
||||
|
||||
utils_src_mip := mathmip \
|
||||
replace
|
||||
|
|
|
@ -34,6 +34,7 @@ int CFileIO::FilePosList[FILEPOS_MAX];
|
|||
sFAT *CFileIO::MainFAT=0;
|
||||
sASyncQueue CFileIO::ASyncQueue;
|
||||
bool CFileIO::ASyncFlag;
|
||||
bool CFileIO::LogFlag;
|
||||
|
||||
/*****************************************************************************/
|
||||
sDataBank CFileIO::DataBank[DATABANK_MAX]=
|
||||
|
@ -90,8 +91,13 @@ int FATSize=FileEquate_MAX*sizeof(sFAT);
|
|||
// CurrentDataBank=DATABANK_MAX;
|
||||
ASyncQueue.Status=BLStatusOffline;
|
||||
ASyncFlag=false;
|
||||
LogFlag=false;
|
||||
#if defined(__USER_daveo__)
|
||||
LogFlag=true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** Open ********************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -192,6 +198,11 @@ u8 * CFileIO::loadFile( FileEquate file, char *allocName )
|
|||
|
||||
Length = getFileSize( file );
|
||||
|
||||
if (LogFlag)
|
||||
{
|
||||
SYSTEM_DBGMSG("File: %i = %i",(int)file,Length);
|
||||
}
|
||||
|
||||
buffer = (u8 *)MemAlloc( Length ,allocName);
|
||||
ASSERT( buffer );
|
||||
#if defined(__CLIMAX_DEVKIT__)
|
||||
|
|
|
@ -124,6 +124,7 @@ static void EnableASync(bool f) {ASyncFlag=f;}
|
|||
static void AddASyncFile(FileEquate file,u8 *Dst);
|
||||
static void LoadASyncFiles();
|
||||
|
||||
static void setLogging(bool f) {LogFlag=f;}
|
||||
private:
|
||||
static void CheckChunk();
|
||||
|
||||
|
@ -137,6 +138,7 @@ static DataBankEquate CurrentDataBank;
|
|||
static sFAT *MainFAT;
|
||||
static sASyncQueue ASyncQueue;
|
||||
static bool ASyncFlag;
|
||||
static bool LogFlag;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -99,24 +99,24 @@ static CFX *Create(const FX_TYPE Type);
|
|||
static CFX *Create(const FX_TYPE Type,CThing *Parent);
|
||||
static CFX *Create(const FX_TYPE Type,DVECTOR const &Pos);
|
||||
|
||||
virtual bool alwaysThink() {return(Flags & FX_FLAG_SCREEN_FX);}
|
||||
virtual void leftThinkZone(int _frames) {if (Flags & FX_FLAG_NO_THINK_KILL) killFX();}
|
||||
bool alwaysThink() {return(Flags & FX_FLAG_SCREEN_FX);}
|
||||
void leftThinkZone(int _frames) {if (Flags & FX_FLAG_NO_THINK_KILL) killFX();}
|
||||
|
||||
virtual void init();
|
||||
void init();
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
virtual void shutdown();
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
|
||||
virtual int canCollide() {return(Flags & FX_FLAG_INJURE_PLAYER);}
|
||||
virtual void SetOtPos(int Ot) {OtPos=Ot;}
|
||||
virtual void setLife(int L) {Life=L;}
|
||||
int canCollide() {return(Flags & FX_FLAG_INJURE_PLAYER);}
|
||||
void SetOtPos(int Ot) {OtPos=Ot;}
|
||||
void setLife(int L) {Life=L;}
|
||||
|
||||
virtual void getFXRenderPos(DVECTOR &Pos);
|
||||
virtual bool getFXParentPos(DVECTOR &Pos);
|
||||
void getFXRenderPos(DVECTOR &Pos);
|
||||
bool getFXParentPos(DVECTOR &Pos);
|
||||
|
||||
virtual void killFX();
|
||||
virtual void toggleVisible() {Flags ^=FX_FLAG_HIDDEN;}
|
||||
void toggleVisible() {Flags ^=FX_FLAG_HIDDEN;}
|
||||
|
||||
protected:
|
||||
void collidedWith(CThing *_thisThing);
|
||||
|
|
|
@ -23,10 +23,10 @@ virtual void render();
|
|||
|
||||
void setBaseData(void *Data);
|
||||
|
||||
virtual void SetScale(int S) {CurrentScaleX=CurrentScaleY=S;}
|
||||
virtual void SetScaleX(int S) {CurrentScaleX=S;}
|
||||
virtual void SetScaleY(int S) {CurrentScaleY=S;}
|
||||
virtual void SetHeading(int H) {CurrentHeading=H;}
|
||||
/*virtual */void SetScale(int S) {CurrentScaleX=CurrentScaleY=S;}
|
||||
/*virtual */void SetScaleX(int S) {CurrentScaleX=S;}
|
||||
/*virtual */void SetScaleY(int S) {CurrentScaleY=S;}
|
||||
/*virtual */void SetHeading(int H) {CurrentHeading=H;}
|
||||
|
||||
protected:
|
||||
bool HasInit;
|
||||
|
|
|
@ -31,11 +31,11 @@ public:
|
|||
LIST_SIZE = 16
|
||||
};
|
||||
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
/*virtual */void init(DVECTOR const &Pos);
|
||||
/*virtual */void think(int _frames);
|
||||
/*virtual */void render();
|
||||
|
||||
virtual sList &moveHead();
|
||||
/*virtual */sList &moveHead();
|
||||
|
||||
protected:
|
||||
sList List[LIST_SIZE];
|
||||
|
|
|
@ -12,9 +12,9 @@ class CFXFallingTile : public CFX
|
|||
{
|
||||
public:
|
||||
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
/*virtual */void init(DVECTOR const &Pos);
|
||||
/*virtual */void think(int _frames);
|
||||
/*virtual */void render();
|
||||
void SetTile(int T) {Tile=T;}
|
||||
protected:
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
class CFXGeyser : public CFX
|
||||
{
|
||||
public:
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
virtual void think(int Frames);
|
||||
virtual void render();
|
||||
/*virtual */void init(DVECTOR const &Pos);
|
||||
/*virtual */void think(int Frames);
|
||||
/*virtual */void render();
|
||||
|
||||
void setHeight(int H) {TargetHeight=H;}
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ class CFXJellyFishLegs : public CFX
|
|||
{
|
||||
public:
|
||||
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
/*virtual */void init(DVECTOR const &Pos);
|
||||
/*virtual */void think(int _frames);
|
||||
/*virtual */void render();
|
||||
|
||||
void Setup(int XOfs,int YOfs,bool XFlip);
|
||||
void setScale( s16 newScale ) {Scale = newScale;}
|
||||
|
|
|
@ -14,8 +14,8 @@ public:
|
|||
void init(DVECTOR const &Pos);
|
||||
void think(int _frames);
|
||||
void render();
|
||||
virtual int canCollide() {return true;}
|
||||
virtual int checkCollisionAgainst(CThing *_thisThing, int _frames);
|
||||
/*virtual */int canCollide() {return true;}
|
||||
/*virtual */int checkCollisionAgainst(CThing *_thisThing, int _frames);
|
||||
|
||||
void setOffset(DVECTOR &Pos);
|
||||
void setTarget(DVECTOR &Pos);
|
||||
|
@ -23,7 +23,7 @@ virtual int checkCollisionAgainst(CThing *_thisThing, int _frames);
|
|||
void setRGB(u8 r,u8 g,u8 b) {R=r; G=g; B=g;}
|
||||
|
||||
protected:
|
||||
virtual void collidedWith(CThing *_thisThing);
|
||||
/*virtual */void collidedWith(CThing *_thisThing);
|
||||
DVECTOR Offset,Target;
|
||||
u8 R,G,B;
|
||||
};
|
||||
|
|
|
@ -12,9 +12,9 @@ class CFXNRGBar : public CFX
|
|||
{
|
||||
public:
|
||||
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
/*virtual*/ void init(DVECTOR const &Pos);
|
||||
/*virtual*/ void think(int _frames);
|
||||
/*virtual*/ void render();
|
||||
|
||||
void SetMax(int Max) {MaxHealth=Max-1;}
|
||||
bool alwaysThink() {return(true);}
|
||||
|
|
|
@ -12,8 +12,8 @@ class CFXSmoke : public CFX
|
|||
{
|
||||
public:
|
||||
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
virtual void think(int _frames);
|
||||
/*virtual*/ void init(DVECTOR const &Pos);
|
||||
/*virtual*/ void think(int _frames);
|
||||
|
||||
void setRate(int R) {Rate=R;}
|
||||
|
||||
|
@ -26,9 +26,9 @@ class CFXSmokePuff : public CFX
|
|||
{
|
||||
public:
|
||||
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
/*virtual*/ void init(DVECTOR const &Pos);
|
||||
/*virtual*/ void think(int _frames);
|
||||
/*virtual*/ void render();
|
||||
|
||||
protected:
|
||||
POLY_FT4 *Frame;
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
class CFXThwack : public CFX
|
||||
{
|
||||
public:
|
||||
virtual void init(DVECTOR const &Pos);
|
||||
virtual void render();
|
||||
/*virtual*/ void init(DVECTOR const &Pos);
|
||||
/*virtual*/ void render();
|
||||
|
||||
protected:
|
||||
u16 Angle,Scale;
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
#include "gfx\animtex.h"
|
||||
#include "gfx\tpage.h"
|
||||
#include "utils\utils.h"
|
||||
#include "utils\pak.h"
|
||||
//#include "utils\pak.h"
|
||||
#include "utils\lznp.h"
|
||||
|
||||
#ifndef __SYSTEM_GSTATE_H__
|
||||
#include "system\gstate.h"
|
||||
|
@ -212,7 +213,9 @@ void CPakTex::DMAPakTex()
|
|||
for (int i=0; i<PakTexCount; i++)
|
||||
{
|
||||
ASSERT(UnpackBuffer);
|
||||
PAK_doUnpak(UnpackBuffer,PakTexList[i].PakSpr);
|
||||
// PAK_doUnpak(UnpackBuffer,PakTexList[i].PakSpr);
|
||||
// PAK_doUnpak(UnpackBuffer,PakTexList[i].PakSpr);
|
||||
LZNP_Decode(PakTexList[i].PakSpr,UnpackBuffer);
|
||||
LoadImage( PakTexList[i].DstRect, (u32*)UnpackBuffer);
|
||||
}
|
||||
PakTexCount=0;
|
||||
|
|
|
@ -105,10 +105,7 @@ sBBox CThingManager::m_ThinkBBox;
|
|||
|
||||
#ifdef USE_FREE_LIST
|
||||
CThing **CThingManager::s_FreeList[CThing::MAX_TYPE];
|
||||
CThing *DuffList;
|
||||
int FreeListCount=0;
|
||||
int DuffListCount=0;
|
||||
|
||||
|
||||
struct sFreeListTable
|
||||
{
|
||||
|
@ -436,7 +433,7 @@ DVECTOR const &CamPos=CLevel::getCameraPos();
|
|||
case 0: // 0 0
|
||||
break;
|
||||
case 1: // 0 1
|
||||
thing->enterThinkZone(_frames);
|
||||
// thing->enterThinkZone(_frames);
|
||||
break;
|
||||
case 2: // 1 0
|
||||
thing->leftThinkZone(_frames);
|
||||
|
@ -896,7 +893,6 @@ void CThingManager::initFreeList()
|
|||
s_FreeList[ThisType.Type]=List;
|
||||
|
||||
}
|
||||
DuffList=0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -916,7 +912,7 @@ void CThingManager::resetFreeList()
|
|||
while (ThisThing)
|
||||
{
|
||||
CThing *Next=ThisThing->NextFreeThing;
|
||||
ThisThing->destroy();
|
||||
// ThisThing->destroy();
|
||||
delete ThisThing;
|
||||
FreeListCount--;
|
||||
ThisThing=Next;
|
||||
|
@ -924,14 +920,6 @@ void CThingManager::resetFreeList()
|
|||
List[t]=0;
|
||||
}
|
||||
}
|
||||
CThing *Duff=DuffList;
|
||||
while (Duff)
|
||||
{
|
||||
CThing *next=Duff->NextFreeThing;
|
||||
delete Duff;
|
||||
DuffListCount--;
|
||||
Duff=next;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -981,7 +969,7 @@ CThing **List=s_FreeList[Type];
|
|||
|
||||
// Check its been aquired/set correctly
|
||||
|
||||
ASSERT(SubType!=1234);
|
||||
ASSERT(SubType!=255);
|
||||
|
||||
Thing->NextFreeThing=List[SubType];
|
||||
List[SubType]=Thing;
|
||||
|
|
|
@ -122,11 +122,11 @@ public:
|
|||
CThing()
|
||||
{
|
||||
initDef();
|
||||
m_SubType=1234;
|
||||
m_SubType=255;
|
||||
}
|
||||
virtual ~CThing() {;}
|
||||
|
||||
virtual void initDef()
|
||||
/*virtual*/ void initDef()
|
||||
{
|
||||
Pos.vx=0; Pos.vy=0;
|
||||
PosDelta=Pos;
|
||||
|
@ -135,22 +135,22 @@ virtual void initDef()
|
|||
NextFreeThing=0;
|
||||
}
|
||||
|
||||
virtual TYPE getThingType()=0;
|
||||
virtual TYPE getThingType()=0;
|
||||
|
||||
virtual void setThingSubType(int T) {m_SubType=T;}
|
||||
virtual int getThingSubType() {return(m_SubType);}
|
||||
/*virtual */void setThingSubType(int T) {m_SubType=T;}
|
||||
/*virtual */int getThingSubType() {return(m_SubType);}
|
||||
|
||||
virtual void create() {;} // Once only init (for mem alloc)
|
||||
virtual void init(); // re-usable init
|
||||
virtual void shutdown(); // re-usable shutdown
|
||||
virtual void destroy() {;} // memory clean up when totally killing the poor things
|
||||
//virtual void create() {;} // Once only init (for mem alloc)
|
||||
virtual void init(); // re-usable init
|
||||
virtual void shutdown(); // re-usable shutdown
|
||||
//virtual void destroy() {;} // memory clean up when totally killing the poor things
|
||||
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
void setToShutdown(bool f=true) {m_isShuttingDown = f;}
|
||||
u8 isSetToShutdown() {return( m_isShuttingDown);}
|
||||
virtual int dontKillDuringLevelRespawn() {return false;}
|
||||
void calcRenderPos(DVECTOR const &Pos,DVECTOR &renderPos);
|
||||
virtual void think(int _frames);
|
||||
virtual void render();
|
||||
void setToShutdown(bool f=true) {m_isShuttingDown = f;}
|
||||
u8 isSetToShutdown() {return( m_isShuttingDown);}
|
||||
virtual int dontKillDuringLevelRespawn() {return false;}
|
||||
void calcRenderPos(DVECTOR const &Pos,DVECTOR &renderPos);
|
||||
|
||||
// Linkage
|
||||
void addChild(CThing *Child);
|
||||
|
@ -173,7 +173,7 @@ protected:
|
|||
|
||||
// Parent Child Linkage
|
||||
CThing *ParentThing,*NextThing;
|
||||
int m_numChildren;
|
||||
u8 m_numChildren;
|
||||
|
||||
public:
|
||||
// Collision/List Link List
|
||||
|
@ -189,13 +189,13 @@ virtual CRECT const *getRenderBBox() {return &m_collisionArea;}
|
|||
virtual CRECT const *getThinkBBox() {return &m_collisionArea;}
|
||||
virtual bool alwaysThink() {return(false);}
|
||||
virtual void leftThinkZone(int _frames) {}
|
||||
virtual void enterThinkZone(int _frames) {}
|
||||
//virtual void enterThinkZone(int _frames) {}
|
||||
|
||||
void ShowBBox();
|
||||
DVECTOR const &getCollisionCentre() {return m_collisionCentre;}
|
||||
DVECTOR const &getCollisionCentreOffset() {return m_collisionCentreOffset;}
|
||||
int getCollisionRadius() {return m_collisionRadius;}
|
||||
virtual CRECT const &getCollisionArea() {return m_collisionArea;}
|
||||
/*virtual */CRECT const &getCollisionArea() {return m_collisionArea;}
|
||||
DVECTOR const &getCollisionSize() {return m_collisionSize;}
|
||||
|
||||
virtual int canCollide() {return true;}
|
||||
|
@ -215,20 +215,20 @@ public:
|
|||
bool canThink() {return (m_thinkFlag);}
|
||||
|
||||
protected:
|
||||
bool m_renderFlag,m_thinkFlag;
|
||||
DVECTOR m_RenderPos;
|
||||
bool m_isShuttingDown;
|
||||
int m_SubType;
|
||||
u8 m_renderFlag,m_thinkFlag;
|
||||
u8 m_isShuttingDown;
|
||||
u8 m_SubType;
|
||||
|
||||
protected:
|
||||
virtual void setCollisionSize(int _w,int _h);
|
||||
virtual void setCollisionCentreOffset(int _x,int _y) {m_collisionCentreOffset.vx=_x;m_collisionCentreOffset.vy=_y;}
|
||||
virtual void setCollisionCentreOffset(DVECTOR xy) {m_collisionCentreOffset=xy;}
|
||||
/*virtual */void setCollisionSize(int _w,int _h);
|
||||
/*virtual */void setCollisionCentreOffset(int _x,int _y) {m_collisionCentreOffset.vx=_x;m_collisionCentreOffset.vy=_y;}
|
||||
/*virtual */void setCollisionCentreOffset(DVECTOR xy) {m_collisionCentreOffset=xy;}
|
||||
|
||||
private:
|
||||
DVECTOR m_collisionSize;
|
||||
DVECTOR m_collisionCentreOffset;
|
||||
int m_collisionRadius;
|
||||
s16 m_collisionRadius;
|
||||
CRECT m_collisionArea;
|
||||
DVECTOR m_collisionCentre;
|
||||
|
||||
|
|
Binary file not shown.
Loading…
Add table
Reference in a new issue