Rename base DvdRequest class to IDvdRequest

Add CAi stubs
This commit is contained in:
Phillip Stephens 2015-10-29 00:52:15 -07:00
parent 3209748a66
commit 1e55a59568
9 changed files with 201 additions and 15 deletions

View File

@ -16,6 +16,8 @@ public:
CActor(TUniqueId, bool, const std::string&, const CEntityInfo&, CActor(TUniqueId, bool, const std::string&, const CEntityInfo&,
const CTransform&, const CModelData&, const CMaterialList&, const CTransform&, const CModelData&, const CMaterialList&,
const CActorParameters&, TUniqueId); const CActorParameters&, TUniqueId);
virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {}
}; };
} }

View File

@ -1,17 +1,176 @@
#ifndef __RETRO_CAI_HPP__ #ifndef __RETRO_CAI_HPP__
#define __RETRO_CAI_HPP__ #define __RETRO_CAI_HPP__
#include "GCNTypes.hpp"
#include "ScriptObjectSupport.hpp"
#include "RetroTypes.hpp"
#include "CEntity.hpp"
#include "CPhysicsActor.hpp"
#include <MathLib.hpp>
namespace Retro namespace Retro
{ {
class CAiFuncMap /* TODO: Figure out what all this is for and move it somewhere appropriate */
enum EStateMsg
{ {
}; };
class CAi enum EListenNoiseType
{ {
};
class CAiFuncMap
{
/* TODO: Figure out return type, I think it's a string */
void GetStateFunc(const char*);
void GetTriggerFunc(const char*);
};
/* TODO: Move these */
class CHealthInfo
{
};
class CDamageVulnerability
{
};
class CStateManager;
class CAi : public CPhysicsActor
{
CHealthInfo x240_healthInfo;
CDamageVulnerability x248_damageVulnerability;
public: public:
void CreateFuncLookup(CAiFuncMap* funcMap) { }
void GetStateFunc(const char*) {}
void GetTrigerFunc(const char*) {}
void GetStateMachine() {}
/* TODO: Figure out the return types, if any, and fix these prototypes */
virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {}
virtual CHealthInfo HealthInfo(CStateManager&) { return x240_healthInfo; }
virtual CHealthInfo GetHealthInfo(const CStateManager&) { return x240_healthInfo; }
virtual CDamageVulnerability GetDamageVulnerability() { return x248_damageVulnerability; }
virtual void TakeDamage(const Zeus::CVector3f&, float) {}
virtual bool CanBeShot(const CStateManager&, int) { return true; }
virtual bool IsListening() { return false; }
virtual int Listen(const Zeus::CVector3f&, EListenNoiseType) { return 0; }
virtual void Patrol(CStateManager&, EStateMsg, float) {}
virtual void FollowPattern(CStateManager&, EStateMsg, float) {}
virtual void Dead(CStateManager&, EStateMsg, float) {}
virtual void PathFind(CStateManager&, EStateMsg, float) {}
virtual void Start(CStateManager&, EStateMsg, float) {}
virtual void SelectTarget(CStateManager&, EStateMsg, float) {}
virtual void TargetPatrol(CStateManager&, EStateMsg, float) {}
virtual void TargetPlayer(CStateManager&, EStateMsg, float) {}
virtual void TargetCover(CStateManager&, EStateMsg, float) {}
virtual void Halt(CStateManager&, EStateMsg, float) {}
virtual void Walk(CStateManager&, EStateMsg, float) {}
virtual void Run(CStateManager&, EStateMsg, float) {}
virtual void Generate(CStateManager&, EStateMsg, float) {}
virtual void Deactivate(CStateManager&, EStateMsg, float) {}
virtual void Attack(CStateManager&, EStateMsg, float) {}
virtual void LoopedAttack(CStateManager&, EStateMsg, float) {}
virtual void JumpBack(CStateManager&, EStateMsg, float) {}
virtual void DoubleSnap(CStateManager&, EStateMsg, float) {}
virtual void Shuffle(CStateManager&, EStateMsg, float) {}
virtual void TurnAround(CStateManager&, EStateMsg, float) {}
virtual void Skid(CStateManager&, EStateMsg, float) {}
virtual void Active(CStateManager&, EStateMsg, float) {}
virtual void InActive(CStateManager&, EStateMsg, float) {}
virtual void CoverAttack(CStateManager&, EStateMsg, float) {}
virtual void Crouch(CStateManager&, EStateMsg, float) {}
virtual void FadeIn(CStateManager&, EStateMsg, float) {}
virtual void FadeOut(CStateManager&, EStateMsg, float) {}
virtual void GetUp(CStateManager&, EStateMsg, float) {}
virtual void Taunt(CStateManager&, EStateMsg, float) {}
virtual void Suck(CStateManager&, EStateMsg, float) {}
virtual void Flee(CStateManager&, EStateMsg, float) {}
virtual void Lurk(CStateManager&, EStateMsg, float) {}
virtual void ProjectileAttack(CStateManager&, EStateMsg, float) {}
virtual void Flinch(CStateManager&, EStateMsg, float) {}
virtual void Hurled(CStateManager&, EStateMsg, float) {}
virtual void TelegraphAttack(CStateManager&, EStateMsg, float) {}
virtual void Jump(CStateManager&, EStateMsg, float) {}
virtual void Explode(CStateManager&, EStateMsg, float) {}
virtual void Dodge(CStateManager&, EStateMsg, float) {}
virtual void Retreat(CStateManager&, EStateMsg, float) {}
virtual void Cover(CStateManager&, EStateMsg, float) {}
virtual void Approach(CStateManager&, EStateMsg, float) {}
virtual void WallHang(CStateManager&, EStateMsg, float) {}
virtual void WallDetach(CStateManager&, EStateMsg, float) {}
virtual void Enraged(CStateManager&, EStateMsg, float) {}
virtual void SpecialAttack(CStateManager&, EStateMsg, float) {}
virtual void Growth(CStateManager&, EStateMsg, float) {}
virtual void Faint(CStateManager&, EStateMsg, float) {}
virtual void BulbAttack(CStateManager&, EStateMsg, float) {}
virtual void PodAttack(CStateManager&, EStateMsg, float) {}
virtual void InAttackPosition(CStateManager&, float) {}
virtual void Leash(CStateManager&, float) {}
virtual void OffLine(CStateManager&,float) {}
virtual void Attacked(CStateManager&, float) {}
virtual void PathShagged(CStateManager&,float) {}
virtual void PathOver(CStateManager&,float) {}
virtual void TooClose(CStateManager&,float) {}
virtual void InRange(CStateManager&,float) {}
virtual void InMaxRange(CStateManager&,float) {}
virtual void InDetectionRange(CStateManager&,float) {}
virtual void SpotPlayer(CStateManager&,float) {}
virtual void PlayerSpot(CStateManager&,float) {}
virtual void PatternOver(CStateManager&,float) {}
virtual void PatternedShagged(CStateManager&,float) {}
virtual void HasAttackPattern(CStateManager&,float) {}
virtual void HasPatrolPath(CStateManager&,float) {}
virtual void HasRetreatPattern(CStateManager&,float) {}
virtual void Delay(CStateManager&,float) {}
virtual void RandomDelay(CStateManager&,float) {}
virtual void FixedDelay(CStateManager&,float) {}
virtual void AnimOver(CStateManager&, float) {}
virtual void ShouldAttack(CStateManager&,float) {}
virtual void ShouldDoubleSnap(CStateManager&,float) {}
virtual void InPosition(CStateManager&,float) {}
virtual void ShouldTurn(CStateManager&,float) {}
virtual void HitSomething(CStateManager&,float) {}
virtual void ShouldJumpBack(CStateManager&,float) {}
virtual void Stuck(CStateManager&,float) {}
virtual void NoPathNodes(CStateManager&,float) {}
virtual void Landed(CStateManager&,float) {}
virtual void HearShot(CStateManager&,float) {}
virtual void HearPlayer(CStateManager&,float) {}
virtual void CoverCheck(CStateManager&, float) {}
virtual void CoverFind(CStateManager&, float) {}
virtual void CoverBlown(CStateManager&, float) {}
virtual void CoverNearlyBlown(CStateManager&, float) {}
virtual void CoveringFire(CStateManager&, float) {}
virtual void GotUp(CStateManager&,float) {}
virtual void LineOfSight(CStateManager&,float) {}
virtual void AggressionCheck(CStateManager&, float) {}
virtual void AttackOver(CStateManager&, float) {}
virtual void ShouldTaunt(CStateManager&,float) {}
virtual void Inside(CStateManager&,float) {}
virtual void ShouldFire(CStateManager&,float) {}
virtual void ShouldFlinch(CStateManager&,float) {}
virtual void PatrolPathOver(CStateManager&,float) {}
virtual void ShouldDodge(CStateManager&,float) {}
virtual void ShouldRetreat(CStateManager&,float) {}
virtual void ShouldCrouch(CStateManager&,float) {}
virtual void ShouldMove(CStateManager&,float) {}
virtual void ShotAt(CStateManager&,float) {}
virtual void HasTargettingPoint(CStateManager&,float) {}
virtual void ShouldWallHang(CStateManager&,float) {}
virtual void SetAIStage(CStateManager&,float) {}
virtual void AIStage(CStateManager&,float) {}
virtual void StartAttack(CStateManager&,float) {}
virtual void BreakAttack(CStateManager&, float) {}
virtual void ShoulStrafe(CStateManager&,float) {}
virtual void ShouldSpecialAttack(CStateManager&,float) {}
virtual void LostInterest(CStateManager&,float) {}
}; };
} }

View File

@ -16,7 +16,7 @@ enum ESeekOrigin
}; };
struct DVDFileInfo; struct DVDFileInfo;
class CDvdRequest; class IDvdRequest;
class CDvdFile class CDvdFile
{ {
@ -29,9 +29,9 @@ public:
static void internalCallback(s32, DVDFileInfo*) {} static void internalCallback(s32, DVDFileInfo*) {}
static bool FileExists(const char*) {return false;} static bool FileExists(const char*) {return false;}
void CloseFile() {} void CloseFile() {}
CDvdRequest* AsyncSeekRead(void*, u32, ESeekOrigin, int) {return nullptr;} IDvdRequest* AsyncSeekRead(void*, u32, ESeekOrigin, int) {return nullptr;}
void SyncSeekRead(void*, u32, ESeekOrigin, int) {} void SyncSeekRead(void*, u32, ESeekOrigin, int) {}
CDvdRequest* AsyncRead(void*, u32) {return nullptr;} IDvdRequest* AsyncRead(void*, u32) {return nullptr;}
void SyncRead(void*, u32) {} void SyncRead(void*, u32) {}
void StallForARAMFile() {} void StallForARAMFile() {}
void StartARAMFileLoad() {} void StartARAMFileLoad() {}

17
Runtime/CDvdRequest.cpp Normal file
View File

@ -0,0 +1,17 @@
#include "CDvdRequest.hpp"
namespace Retro
{
void CDvdRequest::WaitUntilComplete()
{
}
bool CDvdRequest::IsComplete()
{
return false;
}
void CDvdRequest::PostCancelRequest()
{
}
}

View File

@ -4,7 +4,7 @@
namespace Retro namespace Retro
{ {
class CDvdRequest class IDvdRequest
{ {
public: public:
virtual void WaitUntilComplete()=0; virtual void WaitUntilComplete()=0;
@ -20,7 +20,7 @@ public:
virtual EMediaType GetMediaType() const=0; virtual EMediaType GetMediaType() const=0;
}; };
class CNODDvdRequest : public CDvdRequest class CNODDvdRequest : public IDvdRequest
{ {
public: public:
void WaitUntilComplete(); void WaitUntilComplete();
@ -29,6 +29,14 @@ public:
EMediaType GetMediaType() const {return MediaNOD;} EMediaType GetMediaType() const {return MediaNOD;}
}; };
class CDvdRequest : public IDvdRequest
{
void WaitUntilComplete();
bool IsComplete();
void PostCancelRequest();
EMediaType GetMediaType() const { return MediaReal; }
};
} }
#endif // __RETRO_CDVDREQUEST_HPP__ #endif // __RETRO_CDVDREQUEST_HPP__

View File

@ -30,7 +30,7 @@ private:
PakAsyncDataLoad = 2, PakAsyncDataLoad = 2,
PakAsyncLoaded = 3 PakAsyncLoaded = 3
} x2c_asyncLoadPhase; } x2c_asyncLoadPhase;
CDvdRequest* x34_dvdReq; IDvdRequest* x34_dvdReq;
std::vector<std::pair<std::string, SObjectTag>> x4c_nameList; std::vector<std::pair<std::string, SObjectTag>> x4c_nameList;
std::vector<u32> x5c_depList; std::vector<u32> x5c_depList;
std::vector<std::pair<u32, SResInfo>> x6c_resList; std::vector<std::pair<u32, SResInfo>> x6c_resList;

View File

@ -7,7 +7,7 @@
namespace Retro namespace Retro
{ {
class CDvdRequest; class IDvdRequest;
class CResFactory : public IFactory class CResFactory : public IFactory
{ {
@ -16,7 +16,7 @@ public:
struct SLoadingData struct SLoadingData
{ {
SObjectTag tag; SObjectTag tag;
CDvdRequest* dvdReq; IDvdRequest* dvdReq;
IObj** targetPtr; IObj** targetPtr;
void* loadBuffer; void* loadBuffer;
u32 resSize; u32 resSize;

View File

@ -100,13 +100,13 @@ CInputStream* CResLoader::LoadNewResourceSync(const SObjectTag& tag, void* extBu
return newStrm; return newStrm;
} }
CDvdRequest* CResLoader::LoadResourcePartAsync(const SObjectTag& tag, int offset, int length, void* buf) IDvdRequest* CResLoader::LoadResourcePartAsync(const SObjectTag& tag, int offset, int length, void* buf)
{ {
return FindResourceForLoad(tag.id)->AsyncSeekRead(buf, length, return FindResourceForLoad(tag.id)->AsyncSeekRead(buf, length,
OriginBegin, x50_cachedResInfo->x4_offset + offset); OriginBegin, x50_cachedResInfo->x4_offset + offset);
} }
CDvdRequest* CResLoader::LoadResourceAsync(const SObjectTag& tag, void* buf) IDvdRequest* CResLoader::LoadResourceAsync(const SObjectTag& tag, void* buf)
{ {
return FindResourceForLoad(tag.id)->AsyncSeekRead(buf, ROUND_UP_32(x50_cachedResInfo->x8_size), return FindResourceForLoad(tag.id)->AsyncSeekRead(buf, ROUND_UP_32(x50_cachedResInfo->x8_size),
OriginBegin, x50_cachedResInfo->x4_offset); OriginBegin, x50_cachedResInfo->x4_offset);

View File

@ -10,7 +10,7 @@
namespace Retro namespace Retro
{ {
struct SObjectTag; struct SObjectTag;
class CDvdRequest; class IDvdRequest;
class CResLoader class CResLoader
{ {
@ -28,8 +28,8 @@ public:
void LoadMemResourceSync(const SObjectTag& tag, void** bufOut, int* sizeOut); void LoadMemResourceSync(const SObjectTag& tag, void** bufOut, int* sizeOut);
CInputStream* LoadResourceFromMemorySync(const SObjectTag& tag, const void* buf); CInputStream* LoadResourceFromMemorySync(const SObjectTag& tag, const void* buf);
CInputStream* LoadNewResourceSync(const SObjectTag& tag, void* extBuf=nullptr); CInputStream* LoadNewResourceSync(const SObjectTag& tag, void* extBuf=nullptr);
CDvdRequest* LoadResourcePartAsync(const SObjectTag& tag, int offset, int length, void* buf); IDvdRequest* LoadResourcePartAsync(const SObjectTag& tag, int offset, int length, void* buf);
CDvdRequest* LoadResourceAsync(const SObjectTag& tag, void* buf); IDvdRequest* LoadResourceAsync(const SObjectTag& tag, void* buf);
bool GetResourceCompression(const SObjectTag& tag); bool GetResourceCompression(const SObjectTag& tag);
u32 ResourceSize(const SObjectTag& tag); u32 ResourceSize(const SObjectTag& tag);
bool ResourceExists(const SObjectTag& tag); bool ResourceExists(const SObjectTag& tag);