summaryrefslogtreecommitdiffstats
path: root/src/rw
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-04-15 14:05:24 +0200
committeraap <aap@papnet.eu>2020-04-15 14:05:40 +0200
commit90be379bede299aa53bca5027ecc19c356e50f86 (patch)
tree40a5d2e19da49d0007faf39e4762d96d02c6cba2 /src/rw
parentMerge pull request #435 from GTAmodding/appveyor (diff)
downloadre3-90be379bede299aa53bca5027ecc19c356e50f86.tar
re3-90be379bede299aa53bca5027ecc19c356e50f86.tar.gz
re3-90be379bede299aa53bca5027ecc19c356e50f86.tar.bz2
re3-90be379bede299aa53bca5027ecc19c356e50f86.tar.lz
re3-90be379bede299aa53bca5027ecc19c356e50f86.tar.xz
re3-90be379bede299aa53bca5027ecc19c356e50f86.tar.zst
re3-90be379bede299aa53bca5027ecc19c356e50f86.zip
Diffstat (limited to 'src/rw')
-rw-r--r--src/rw/ClumpRead.cpp6
-rw-r--r--src/rw/RwHelper.cpp4
-rw-r--r--src/rw/RwMatFX.cpp4
-rw-r--r--src/rw/TexRead.cpp25
-rw-r--r--src/rw/rw.cpp2
5 files changed, 33 insertions, 8 deletions
diff --git a/src/rw/ClumpRead.cpp b/src/rw/ClumpRead.cpp
index c9f027e7..0bf62f32 100644
--- a/src/rw/ClumpRead.cpp
+++ b/src/rw/ClumpRead.cpp
@@ -153,7 +153,7 @@ RpClumpGtaStreamRead1(RwStream *stream)
if(!RwStreamFindChunk(stream, rwID_FRAMELIST, nil, &version))
return false;
- if(_rwFrameListStreamRead(stream, &gFrameList) == nil)
+ if(rwFrameListStreamRead(stream, &gFrameList) == nil)
return false;
if(!RwStreamFindChunk(stream, rwID_GEOMETRYLIST, nil, &version)){
@@ -164,7 +164,7 @@ RpClumpGtaStreamRead1(RwStream *stream)
rwFrameListDeinitialize(&gFrameList);
return false;
}
- streamPosition = stream->Type.memory.position;
+ streamPosition = STREAMPOS(stream);
return true;
}
@@ -180,7 +180,7 @@ RpClumpGtaStreamRead2(RwStream *stream)
if(clump == nil)
return nil;
- RwStreamSkip(stream, streamPosition - stream->Type.memory.position);
+ RwStreamSkip(stream, streamPosition - STREAMPOS(stream));
if(GeometryListStreamRead2(stream, &gGeomList) == nil){
GeometryListDeinitialize(&gGeomList);
diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp
index 44ca3a0a..cf1a6f2b 100644
--- a/src/rw/RwHelper.cpp
+++ b/src/rw/RwHelper.cpp
@@ -90,9 +90,13 @@ DefinedState(void)
RwRenderStateSet(rwRENDERSTATEFOGTYPE, (void*)rwFOGTYPELINEAR);
RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
+#ifdef LIBRW
+ #pragma message (" TODO: alphatest func")
+#else
// D3D stuff
RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER);
RwD3D8SetRenderState(D3DRS_ALPHAREF, 2);
+#endif
}
RwFrame*
diff --git a/src/rw/RwMatFX.cpp b/src/rw/RwMatFX.cpp
index 3af6fabe..c4fe0b0b 100644
--- a/src/rw/RwMatFX.cpp
+++ b/src/rw/RwMatFX.cpp
@@ -1,3 +1,5 @@
+#ifndef LIBRW
+
#define WITHD3D
#include "common.h"
#include "patcher.h"
@@ -224,3 +226,5 @@ STARTPATCHES
ENDPATCHES
#endif
+
+#endif
diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp
index 50b99d47..8ada080d 100644
--- a/src/rw/TexRead.cpp
+++ b/src/rw/TexRead.cpp
@@ -25,6 +25,12 @@
float &texLoadTime = *(float*)0x8F1B50;
int32 &texNumLoaded = *(int32*)0x8F252C;
+#ifdef LIBRW
+#define READNATIVE(stream, tex, size) rwNativeTextureHackRead(stream, tex, size)
+#else
+#define READNATIVE(stream, tex, size) RWSRCGLOBAL(stdFunc[rwSTANDARDNATIVETEXTUREREAD](stream, tex, size))
+#endif
+
RwTexture*
RwTextureGtaStreamRead(RwStream *stream)
{
@@ -36,7 +42,7 @@ RwTextureGtaStreamRead(RwStream *stream)
float preloadTime = (float)CTimer::GetCurrentTimeInCycles() / (float)CTimer::GetCyclesPerMillisecond();
- if(!RWSRCGLOBAL(stdFunc[rwSTANDARDNATIVETEXTUREREAD](stream, &tex, size)))
+ if(!READNATIVE(stream, &tex, size))
return nil;
if (gGameState == GS_INIT_PLAYING_GAME) {
@@ -121,7 +127,7 @@ RwTexDictionaryGtaStreamRead1(RwStream *stream)
}
numberTextures = numTextures;
- streamPosition = stream->Type.memory.position;
+ streamPosition = STREAMPOS(stream);
return texDict;
}
@@ -131,7 +137,7 @@ RwTexDictionaryGtaStreamRead2(RwStream *stream, RwTexDictionary *texDict)
{
RwTexture *tex;
- RwStreamSkip(stream, streamPosition - stream->Type.memory.position);
+ RwStreamSkip(stream, streamPosition - STREAMPOS(stream));
while(numberTextures--){
tex = RwTextureGtaStreamRead(stream);
@@ -251,6 +257,12 @@ DealWithTxdWriteError(uint32 num, uint32 count, const char *text)
RsGlobal.quit = true;
}
+#ifdef LIBRW
+#define STREAMTELL(str) str->tell()
+#else
+#define STREAMTELL(str) filesys->rwftell((str)->Type.file.fpFile)
+#endif
+
bool
CreateTxdImageForVideoCard()
{
@@ -260,7 +272,9 @@ CreateTxdImageForVideoCard()
CStreaming::FlushRequestList();
+#ifndef LIBRW
RwFileFunctions *filesys = RwOsGetFileInterface();
+#endif
RwStream *img = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMWRITE, "models\\txd.img");
if (img == nil) {
@@ -287,7 +301,8 @@ CreateTxdImageForVideoCard()
sprintf(filename, "%s.txd", CTxdStore::GetTxdName(i));
if (CTxdStore::GetSlot(i)->texDict) {
- int32 pos = filesys->rwftell(img->Type.file.fpFile);
+
+ int32 pos = STREAMTELL(img);
if (RwTexDictionaryStreamWrite(CTxdStore::GetSlot(i)->texDict, img) == nil) {
DealWithTxdWriteError(i, TXDSTORESIZE, "CVT_ERR");
@@ -298,7 +313,7 @@ CreateTxdImageForVideoCard()
return false;
}
- int32 size = filesys->rwftell(img->Type.file.fpFile) - pos;
+ int32 size = STREAMTELL(img) - pos;
int32 num = size % CDSTREAM_SECTOR_SIZE;
size /= CDSTREAM_SECTOR_SIZE;
diff --git a/src/rw/rw.cpp b/src/rw/rw.cpp
index 3875f2a1..196cf189 100644
--- a/src/rw/rw.cpp
+++ b/src/rw/rw.cpp
@@ -1,3 +1,4 @@
+#ifndef LIBRW
#include "common.h"
#include "patcher.h"
#include "rwcore.h"
@@ -836,4 +837,5 @@ InjectHook(0x5DF040, &RxNodeDefinitionGetLight, PATCH_JUMP);
InjectHook(0x5DF560, &RxNodeDefinitionGetPostLight, PATCH_JUMP);
InjectHook(0x5DFC60, &RxD3D8AllInOneSetRenderCallBack, PATCH_JUMP);
ENDPATCHES
+#endif
#endif \ No newline at end of file