summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
m---------librw0
-rw-r--r--src/animation/AnimManager.cpp6
-rw-r--r--src/core/Streaming.cpp3
-rw-r--r--src/core/main.cpp4
-rw-r--r--src/entities/Entity.cpp22
-rw-r--r--src/extras/debugmenu.cpp36
-rw-r--r--src/extras/debugmenu.h2
-rw-r--r--src/fakerw/fake.cpp6
-rw-r--r--src/rw/RwHelper.cpp20
-rw-r--r--src/rw/RwHelper.h2
-rw-r--r--src/rw/TexRead.cpp5
11 files changed, 70 insertions, 36 deletions
diff --git a/librw b/librw
-Subproject 374f951d7cee353914059d8ddf9c5aff7d76498
+Subproject c4ffa3622ae02f56168a1e93b978987981f3b68
diff --git a/src/animation/AnimManager.cpp b/src/animation/AnimManager.cpp
index 7c09b0dd..ebd2e1fb 100644
--- a/src/animation/AnimManager.cpp
+++ b/src/animation/AnimManager.cpp
@@ -1,6 +1,7 @@
#include "common.h"
#include "General.h"
+#include "RwHelper.h"
#include "ModelInfo.h"
#include "ModelIndices.h"
#include "FileMgr.h"
@@ -754,6 +755,11 @@ CAnimManager::LoadAnimFiles(void)
group->CreateAssociations(def->blockName, clump, def->animNames, def->numAnims);
for(j = 0; j < group->numAssociations; j++)
group->GetAnimation(j)->flags |= def->animDescs[j].flags;
+#ifdef PED_SKIN
+ // forgot on xbox/android
+ if(IsClumpSkinned(clump))
+ RpClumpForAllAtomics(clump, AtomicRemoveAnimFromSkinCB, nil);
+#endif
RpClumpDestroy(clump);
}
}
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp
index 8124d11c..a76e9038 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -754,7 +754,8 @@ CStreaming::RequestSpecialModel(int32 modelId, const char *modelName, int32 flag
}else
RemoveModel(modelId);
- ms_pExtraObjectsDir->FindItem(modelName, pos, size);
+ bool found = ms_pExtraObjectsDir->FindItem(modelName, pos, size);
+ assert(found);
mi->ClearTexDictionary();
if(CTxdStore::FindTxdSlot(modelName) == -1)
mi->SetTexDictionary("generic");
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 7c1f7938..ec37fa28 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -91,7 +91,6 @@ void GameInit(void);
void SystemInit(void);
void TheGame(void);
-void DebugMenuInit(void) {}
void DebugMenuPopulate(void);
@@ -344,6 +343,8 @@ static void
Terminate3D(void)
{
CGame::ShutdownRenderWare();
+
+ DebugMenuShutdown();
RsRwTerminate();
@@ -794,6 +795,7 @@ RenderDebugShit(void)
CRenderer::RenderCollisionLines();
ThePaths.DisplayPathData();
CDebug::DrawLines();
+ DefinedState();
#endif
}
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp
index 756e1232..ee4faa82 100644
--- a/src/entities/Entity.cpp
+++ b/src/entities/Entity.cpp
@@ -285,28 +285,6 @@ CEntity::CreateRwObject(void)
}
}
-#ifdef PED_SKIN
-RpAtomic*
-AtomicRemoveAnimFromSkinCB(RpAtomic *atomic, void *data)
-{
- if(RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic))){
- RpHAnimHierarchy *hier = RpSkinAtomicGetHAnimHierarchy(atomic);
-#ifdef LIBRW
- if(hier && hier->interpolator->currentAnim){
- RpHAnimAnimationDestroy(hier->interpolator->currentAnim);
- hier->interpolator->currentAnim = nil;
- }
-#else
- if(hier && hier->pCurrentAnim){
- RpHAnimAnimationDestroy(hier->pCurrentAnim);
- hier->pCurrentAnim = nil;
- }
-#endif
- }
- return atomic;
-}
-#endif
-
void
CEntity::DeleteRwObject(void)
{
diff --git a/src/extras/debugmenu.cpp b/src/extras/debugmenu.cpp
index d6ee18ab..f419e76f 100644
--- a/src/extras/debugmenu.cpp
+++ b/src/extras/debugmenu.cpp
@@ -95,6 +95,18 @@ createMenuFont(void)
RtCharsetGetDesc(fontStyles[MENUFONT_NORMAL], &fontDesc);
}
+void
+destroyMenuFont(void)
+{
+ RtCharsetDestroy(fontStyles[MENUFONT_NORMAL]);
+ fontStyles[MENUFONT_NORMAL] = nil;
+ RtCharsetDestroy(fontStyles[MENUFONT_SEL_ACTIVE]);
+ fontStyles[MENUFONT_SEL_ACTIVE] = nil;
+ RtCharsetDestroy(fontStyles[MENUFONT_SEL_INACTIVE]);
+ fontStyles[MENUFONT_SEL_INACTIVE] = nil;
+ RtCharsetDestroy(fontStyles[MENUFONT_MOUSE]);
+ fontStyles[MENUFONT_MOUSE] = nil;
+}
@@ -755,7 +767,7 @@ static uint8 arrowPx[] = {
};
void
-initDebug(void)
+DebugMenuInit(void)
{
createMenuFont();
@@ -779,6 +791,22 @@ initDebug(void)
arrow = RwRasterSetFromImage(arrow, img);
assert(arrow);
RwImageDestroy(img);
+
+ menuInitialized = true;
+}
+
+void
+DebugMenuShutdown(void)
+{
+ if(menuInitialized){
+ destroyMenuFont();
+ RwRasterDestroy(cursor);
+ cursor = nil;
+ RwRasterDestroy(arrow);
+ arrow = nil;
+ // TODO: the menus ...
+ }
+ menuInitialized = false;
}
void
@@ -971,10 +999,8 @@ DebugMenuProcess(void)
pad->DisablePlayerControls = 1;
// TODO: this could happen earlier
- if(!menuInitialized){
- initDebug();
- menuInitialized = 1;
- }
+ if(!menuInitialized)
+ DebugMenuInit();
updateMouse();
}
diff --git a/src/extras/debugmenu.h b/src/extras/debugmenu.h
index 29bbd972..3ef8c742 100644
--- a/src/extras/debugmenu.h
+++ b/src/extras/debugmenu.h
@@ -31,6 +31,8 @@ MenuEntry *DebugMenuAddCmd(const char *path, const char *name, TriggerFunc trigg
void DebugMenuEntrySetWrap(MenuEntry *e, bool wrap);
void DebugMenuEntrySetStrings(MenuEntry *e, const char **strings);
void DebugMenuEntrySetAddress(MenuEntry *e, void *addr);
+void DebugMenuInit(void);
+void DebugMenuShutdown(void);
void DebugMenuProcess(void);
void DebugMenuRender(void);
diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp
index b86e9214..dca15dd0 100644
--- a/src/fakerw/fake.cpp
+++ b/src/fakerw/fake.cpp
@@ -241,7 +241,7 @@ RwRaster *RwRasterSetFromImage(RwRaster *raster, RwImage *image) { return raster
RwTexture *RwTextureCreate(RwRaster * raster) { return Texture::create(raster); }
RwBool RwTextureDestroy(RwTexture * texture) { texture->destroy(); return true; }
-RwTexture *RwTextureAddRef(RwTexture *texture) { texture->refCount++; return texture; }
+RwTexture *RwTextureAddRef(RwTexture *texture) { texture->addRef(); return texture; }
// TODO
RwBool RwTextureSetMipmapping(RwBool enable) { return true; }
RwBool RwTextureGetMipmapping(void);
@@ -410,11 +410,11 @@ RwBool RwIm3DRenderLine(RwInt32 vert1, RwInt32 vert2) {
RwImVertexIndex indices[2];
indices[0] = vert1;
indices[1] = vert2;
- im3d::RenderIndexed((PrimitiveType)PRIMTYPELINELIST, indices, 2);
+ im3d::RenderIndexedPrimitive((PrimitiveType)PRIMTYPELINELIST, indices, 2);
return true;
}
RwBool RwIm3DRenderTriangle(RwInt32 vert1, RwInt32 vert2, RwInt32 vert3);
-RwBool RwIm3DRenderIndexedPrimitive(RwPrimitiveType primType, RwImVertexIndex *indices, RwInt32 numIndices) { im3d::RenderIndexed((PrimitiveType)primType, indices, numIndices); return true; }
+RwBool RwIm3DRenderIndexedPrimitive(RwPrimitiveType primType, RwImVertexIndex *indices, RwInt32 numIndices) { im3d::RenderIndexedPrimitive((PrimitiveType)primType, indices, numIndices); return true; }
RwBool RwIm3DRenderPrimitive(RwPrimitiveType primType);
diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp
index 02a07558..42e62105 100644
--- a/src/rw/RwHelper.cpp
+++ b/src/rw/RwHelper.cpp
@@ -312,6 +312,26 @@ HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier)
return anim;
}
+RpAtomic*
+AtomicRemoveAnimFromSkinCB(RpAtomic *atomic, void *data)
+{
+ if(RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic))){
+ RpHAnimHierarchy *hier = RpSkinAtomicGetHAnimHierarchy(atomic);
+#ifdef LIBRW
+ if(hier && hier->interpolator->currentAnim){
+ RpHAnimAnimationDestroy(hier->interpolator->currentAnim);
+ hier->interpolator->currentAnim = nil;
+ }
+#else
+ if(hier && hier->pCurrentAnim){
+ RpHAnimAnimationDestroy(hier->pCurrentAnim);
+ hier->pCurrentAnim = nil;
+ }
+#endif
+ }
+ return atomic;
+}
+
void
RenderSkeleton(RpHAnimHierarchy *hier)
{
diff --git a/src/rw/RwHelper.h b/src/rw/RwHelper.h
index e6740031..8a55a832 100644
--- a/src/rw/RwHelper.h
+++ b/src/rw/RwHelper.h
@@ -21,6 +21,8 @@ RpHAnimHierarchy *GetAnimHierarchyFromClump(RpClump *clump); // get from frame
RwFrame *GetHierarchyFromChildNodesCB(RwFrame *frame, void *data);
void SkinGetBonePositionsToTable(RpClump *clump, RwV3d *boneTable);
RpHAnimAnimation *HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier);
+RpAtomic *AtomicRemoveAnimFromSkinCB(RpAtomic *atomic, void *data);
+void RenderSkeleton(RpHAnimHierarchy *hier);
#endif
RwTexDictionary *RwTexDictionaryGtaStreamRead(RwStream *stream);
diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp
index d1ff3dc0..9f0cae3c 100644
--- a/src/rw/TexRead.cpp
+++ b/src/rw/TexRead.cpp
@@ -66,10 +66,7 @@ RwTexDictionaryGtaStreamRead(RwStream *stream)
if(!RwStreamFindChunk(stream, rwID_STRUCT, &size, &version))
return nil;
- assert(size == 4);
-int foo = RwStreamRead(stream, &numTextures, size);
-if(foo != size)
-// if(RwStreamRead(stream, &numTextures, size) != size)
+ if(RwStreamRead(stream, &numTextures, size) != size)
return nil;
texDict = RwTexDictionaryCreate();