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 "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);
}
}

View file

@ -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");

View file

@ -91,7 +91,6 @@ void GameInit(void);
void SystemInit(void);
void TheGame(void);
void DebugMenuInit(void) {}
void DebugMenuPopulate(void);
@ -345,6 +344,8 @@ Terminate3D(void)
{
CGame::ShutdownRenderWare();
DebugMenuShutdown();
RsRwTerminate();
return;
@ -794,6 +795,7 @@ RenderDebugShit(void)
CRenderer::RenderCollisionLines();
ThePaths.DisplayPathData();
CDebug::DrawLines();
DefinedState();
#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
CEntity::DeleteRwObject(void)
{

View file

@ -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();
}

View file

@ -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);

View file

@ -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);

View file

@ -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)
{

View file

@ -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);

View file

@ -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();