Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
added CFont
  • Loading branch information
aap committed May 22, 2019
1 parent 157926d commit 3b56c51e646723d936c5c6f27d26547a37d4f126
Showing with 656 additions and 19 deletions.
  1. +28 −15 src/TxdStore.cpp
  2. +1 −0 src/TxdStore.h
  3. +515 −0 src/render/Font.cpp
  4. +108 −0 src/render/Font.h
  5. +3 −4 src/render/Sprite2d.h
  6. +1 −0 src/rw.cpp
@@ -4,6 +4,9 @@
#include "Streaming.h"
#include "TxdStore.h"

WRAPPER RwTexDictionary *RwTexDictionaryGtaStreamRead(RwStream *stream) { EAXJMP(0x5924A0); }


CPool<TxdDef,TxdDef> *&CTxdStore::ms_pTxdPool = *(CPool<TxdDef,TxdDef>**)0x8F5FB8;
RwTexDictionary *&CTxdStore::ms_pStoredTxd = *(RwTexDictionary**)0x9405BC;

@@ -32,6 +35,15 @@ CTxdStore::AddTxdSlot(const char *name)
return ms_pTxdPool->GetJustIndex(def);
}

void
CTxdStore::RemoveTxdSlot(int slot)
{
TxdDef *def = GetSlot(slot);
if(def->texDict)
RwTexDictionaryDestroy(def->texDict);
ms_pTxdPool->Delete(def);
}

int
CTxdStore::FindTxdSlot(const char *name)
{
@@ -98,33 +110,34 @@ CTxdStore::RemoveRefWithoutDelete(int slot)
GetSlot(slot)->refCount--;
}

/*
bool
CTxdStore::LoadTxd(int slot, RwStream *stream)
{
TxdDef *def = GetSlot(slot);
if(!rw::findChunk(stream, rw::ID_TEXDICTIONARY, nil, nil)){
return false;
}else{
def->texDict = rw::TexDictionary::streamRead(stream);
convertTxd(def->texDict);

if(RwStreamFindChunk(stream, rwID_TEXDICTIONARY, nil, nil)){
def->texDict = RwTexDictionaryGtaStreamRead(stream);
return def->texDict != nil;
}
printf("Failed to load TXD\n");
return false;
}

bool
CTxdStore::LoadTxd(int slot, const char *filename)
{
rw::StreamFile stream;
if(stream.open(getPath(filename), "rb")){
LoadTxd(slot, &stream);
stream.close();
return true;
}
printf("Failed to open TXD\n");
return false;
RwStream *stream;
bool ret;

ret = false;
_rwD3D8TexDictionaryEnableRasterFormatConversion(true);
do
stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, filename);
while(stream == nil);
ret = LoadTxd(slot, stream);
RwStreamClose(stream, nil);
return ret;
}
*/

void
CTxdStore::RemoveTxd(int slot)
@@ -16,6 +16,7 @@ class CTxdStore
static void Initialize(void);
static void Shutdown(void);
static int AddTxdSlot(const char *name);
static void RemoveTxdSlot(int slot);
static int FindTxdSlot(const char *name);
static char *GetTxdName(int slot);
static void PushCurrentTxd(void);

0 comments on commit 3b56c51

Please sign in to comment.