Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Nikolay Korolev 2020-04-25 12:26:37 +03:00
commit bb14d9689f
10 changed files with 70 additions and 36 deletions

View file

@ -1,6 +1,7 @@
#include "common.h" #include "common.h"
#include "General.h" #include "General.h"
#include "RwHelper.h"
#include "ModelInfo.h" #include "ModelInfo.h"
#include "ModelIndices.h" #include "ModelIndices.h"
#include "FileMgr.h" #include "FileMgr.h"
@ -754,6 +755,11 @@ CAnimManager::LoadAnimFiles(void)
group->CreateAssociations(def->blockName, clump, def->animNames, def->numAnims); group->CreateAssociations(def->blockName, clump, def->animNames, def->numAnims);
for(j = 0; j < group->numAssociations; j++) for(j = 0; j < group->numAssociations; j++)
group->GetAnimation(j)->flags |= def->animDescs[j].flags; 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); RpClumpDestroy(clump);
} }
} }

View file

@ -754,7 +754,8 @@ CStreaming::RequestSpecialModel(int32 modelId, const char *modelName, int32 flag
}else }else
RemoveModel(modelId); RemoveModel(modelId);
ms_pExtraObjectsDir->FindItem(modelName, pos, size); bool found = ms_pExtraObjectsDir->FindItem(modelName, pos, size);
assert(found);
mi->ClearTexDictionary(); mi->ClearTexDictionary();
if(CTxdStore::FindTxdSlot(modelName) == -1) if(CTxdStore::FindTxdSlot(modelName) == -1)
mi->SetTexDictionary("generic"); mi->SetTexDictionary("generic");

View file

@ -91,7 +91,6 @@ void GameInit(void);
void SystemInit(void); void SystemInit(void);
void TheGame(void); void TheGame(void);
void DebugMenuInit(void) {}
void DebugMenuPopulate(void); void DebugMenuPopulate(void);
@ -344,6 +343,8 @@ static void
Terminate3D(void) Terminate3D(void)
{ {
CGame::ShutdownRenderWare(); CGame::ShutdownRenderWare();
DebugMenuShutdown();
RsRwTerminate(); RsRwTerminate();
@ -794,6 +795,7 @@ RenderDebugShit(void)
CRenderer::RenderCollisionLines(); CRenderer::RenderCollisionLines();
ThePaths.DisplayPathData(); ThePaths.DisplayPathData();
CDebug::DrawLines(); CDebug::DrawLines();
DefinedState();
#endif #endif
} }

View file

@ -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 void
CEntity::DeleteRwObject(void) CEntity::DeleteRwObject(void)
{ {

View file

@ -95,6 +95,18 @@ createMenuFont(void)
RtCharsetGetDesc(fontStyles[MENUFONT_NORMAL], &fontDesc); 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 void
initDebug(void) DebugMenuInit(void)
{ {
createMenuFont(); createMenuFont();
@ -779,6 +791,22 @@ initDebug(void)
arrow = RwRasterSetFromImage(arrow, img); arrow = RwRasterSetFromImage(arrow, img);
assert(arrow); assert(arrow);
RwImageDestroy(img); RwImageDestroy(img);
menuInitialized = true;
}
void
DebugMenuShutdown(void)
{
if(menuInitialized){
destroyMenuFont();
RwRasterDestroy(cursor);
cursor = nil;
RwRasterDestroy(arrow);
arrow = nil;
// TODO: the menus ...
}
menuInitialized = false;
} }
void void
@ -971,10 +999,8 @@ DebugMenuProcess(void)
pad->DisablePlayerControls = 1; pad->DisablePlayerControls = 1;
// TODO: this could happen earlier // TODO: this could happen earlier
if(!menuInitialized){ if(!menuInitialized)
initDebug(); DebugMenuInit();
menuInitialized = 1;
}
updateMouse(); updateMouse();
} }

View file

@ -31,6 +31,8 @@ MenuEntry *DebugMenuAddCmd(const char *path, const char *name, TriggerFunc trigg
void DebugMenuEntrySetWrap(MenuEntry *e, bool wrap); void DebugMenuEntrySetWrap(MenuEntry *e, bool wrap);
void DebugMenuEntrySetStrings(MenuEntry *e, const char **strings); void DebugMenuEntrySetStrings(MenuEntry *e, const char **strings);
void DebugMenuEntrySetAddress(MenuEntry *e, void *addr); void DebugMenuEntrySetAddress(MenuEntry *e, void *addr);
void DebugMenuInit(void);
void DebugMenuShutdown(void);
void DebugMenuProcess(void); void DebugMenuProcess(void);
void DebugMenuRender(void); void DebugMenuRender(void);

View file

@ -241,7 +241,7 @@ RwRaster *RwRasterSetFromImage(RwRaster *raster, RwImage *image) { return raster
RwTexture *RwTextureCreate(RwRaster * raster) { return Texture::create(raster); } RwTexture *RwTextureCreate(RwRaster * raster) { return Texture::create(raster); }
RwBool RwTextureDestroy(RwTexture * texture) { texture->destroy(); return true; } 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 // TODO
RwBool RwTextureSetMipmapping(RwBool enable) { return true; } RwBool RwTextureSetMipmapping(RwBool enable) { return true; }
RwBool RwTextureGetMipmapping(void); RwBool RwTextureGetMipmapping(void);
@ -410,11 +410,11 @@ RwBool RwIm3DRenderLine(RwInt32 vert1, RwInt32 vert2) {
RwImVertexIndex indices[2]; RwImVertexIndex indices[2];
indices[0] = vert1; indices[0] = vert1;
indices[1] = vert2; indices[1] = vert2;
im3d::RenderIndexed((PrimitiveType)PRIMTYPELINELIST, indices, 2); im3d::RenderIndexedPrimitive((PrimitiveType)PRIMTYPELINELIST, indices, 2);
return true; return true;
} }
RwBool RwIm3DRenderTriangle(RwInt32 vert1, RwInt32 vert2, RwInt32 vert3); 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); RwBool RwIm3DRenderPrimitive(RwPrimitiveType primType);

View file

@ -312,6 +312,26 @@ HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier)
return anim; 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 void
RenderSkeleton(RpHAnimHierarchy *hier) RenderSkeleton(RpHAnimHierarchy *hier)
{ {

View file

@ -21,6 +21,8 @@ RpHAnimHierarchy *GetAnimHierarchyFromClump(RpClump *clump); // get from frame
RwFrame *GetHierarchyFromChildNodesCB(RwFrame *frame, void *data); RwFrame *GetHierarchyFromChildNodesCB(RwFrame *frame, void *data);
void SkinGetBonePositionsToTable(RpClump *clump, RwV3d *boneTable); void SkinGetBonePositionsToTable(RpClump *clump, RwV3d *boneTable);
RpHAnimAnimation *HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier); RpHAnimAnimation *HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier);
RpAtomic *AtomicRemoveAnimFromSkinCB(RpAtomic *atomic, void *data);
void RenderSkeleton(RpHAnimHierarchy *hier);
#endif #endif
RwTexDictionary *RwTexDictionaryGtaStreamRead(RwStream *stream); RwTexDictionary *RwTexDictionaryGtaStreamRead(RwStream *stream);

View file

@ -66,10 +66,7 @@ RwTexDictionaryGtaStreamRead(RwStream *stream)
if(!RwStreamFindChunk(stream, rwID_STRUCT, &size, &version)) if(!RwStreamFindChunk(stream, rwID_STRUCT, &size, &version))
return nil; return nil;
assert(size == 4); if(RwStreamRead(stream, &numTextures, size) != size)
int foo = RwStreamRead(stream, &numTextures, size);
if(foo != size)
// if(RwStreamRead(stream, &numTextures, size) != size)
return nil; return nil;
texDict = RwTexDictionaryCreate(); texDict = RwTexDictionaryCreate();