diff options
-rw-r--r-- | gob/scenery.cpp | 12 | ||||
-rw-r--r-- | gob/scenery.h | 18 |
2 files changed, 19 insertions, 11 deletions
diff --git a/gob/scenery.cpp b/gob/scenery.cpp index 5b43630670..f592b5ab21 100644 --- a/gob/scenery.cpp +++ b/gob/scenery.cpp @@ -114,6 +114,7 @@ int16 scen_loadStatic(char search) { ptr->layers = (Scen_StaticLayer **)malloc(sizeof(Scen_StaticLayer *) * ptr->layersCount); ptr->pieces = (Scen_PieceDesc **)malloc(sizeof(Scen_PieceDesc *) * picsCount); + ptr->piecesFromExt = (char *)malloc(picsCount); for (i = 0; i < ptr->layersCount; i++) { offset = (int16)READ_LE_UINT16(&((int16 *)dataPtr)[i]); @@ -136,10 +137,12 @@ int16 scen_loadStatic(char search) { ptr->pieces[i] = (Scen_PieceDesc *) game_loadExtData(pictDescId, 0, 0); + ptr->piecesFromExt[i] = 1; } else { ptr->pieces[i] = (Scen_PieceDesc *) game_loadTotResource(pictDescId); + ptr->piecesFromExt[i] = 0; } width = inter_load16(); @@ -188,7 +191,7 @@ void scen_freeStatic(int16 index) { return; for (i = 0; i < scen_staticPictCount[index]; i++) { - if (scen_staticFromExt[index] == 1) + if (scen_statics[index].piecesFromExt[i] == 1) free(scen_statics[index].pieces[i]); spr = scen_staticPictToSprite[index * 7 + i]; @@ -202,6 +205,7 @@ void scen_freeStatic(int16 index) { free(scen_statics[index].layers); free(scen_statics[index].pieces); + free(scen_statics[index].piecesFromExt); if (scen_staticFromExt[index] == 1) free(scen_statics[index].dataPtr); @@ -430,6 +434,7 @@ int16 scen_loadAnim(char search) { ptr->pieces = (Scen_PieceDesc **) malloc(sizeof(Scen_PieceDesc *) * picsCount); + ptr->piecesFromExt = (char *) malloc(picsCount); for (i = 0; i < ptr->layersCount; i++) { offset = (int16)READ_LE_UINT16(&((int16 *)dataPtr)[i]); @@ -449,10 +454,12 @@ int16 scen_loadAnim(char search) { ptr->pieces[i] = (Scen_PieceDesc *) game_loadExtData(pictDescId, 0, 0); + ptr->piecesFromExt[i] = 1; } else { ptr->pieces[i] = (Scen_PieceDesc *) game_loadTotResource(pictDescId); + ptr->piecesFromExt[i] = 0; } width = inter_load16(); @@ -705,7 +712,7 @@ void scen_freeAnim(int16 animation) { return; for (i = 0; i < scen_animPictCount[animation]; i++) { - if (scen_animFromExt[animation] == 1) + if (scen_animations[animation].piecesFromExt[i] == 1) free(scen_animations[animation].pieces[i]); spr = scen_animPictToSprite[animation * 7 + i]; @@ -720,6 +727,7 @@ void scen_freeAnim(int16 animation) { free(scen_animations[animation].layers); free(scen_animations[animation].pieces); + free(scen_animations[animation].piecesFromExt); if (scen_animFromExt[animation] == 1) free(scen_animations[animation].dataPtr); diff --git a/gob/scenery.h b/gob/scenery.h index 90b098ea14..71b59e685c 100644 --- a/gob/scenery.h +++ b/gob/scenery.h @@ -47,14 +47,6 @@ typedef struct Scen_StaticLayer { Scen_StaticPlane planes[1]; } GCC_PACK Scen_StaticLayer; -typedef struct Scen_Static { - int16 layersCount; - Scen_StaticLayer **layers; - Scen_PieceDesc **pieces; - void *unknown; - char *dataPtr; -} GCC_PACK Scen_Static; - // Animations typedef struct Scen_AnimFramePiece { @@ -77,11 +69,19 @@ typedef struct Scen_AnimLayer { } GCC_PACK Scen_AnimLayer; #pragma END_PACK_STRUCTS +typedef struct Scen_Static { + int16 layersCount; + Scen_StaticLayer **layers; + Scen_PieceDesc **pieces; + char *piecesFromExt; + char *dataPtr; +} Scen_Static; + struct Scen_Animation { int16 layersCount; Scen_AnimLayer **layers; Scen_PieceDesc **pieces; - void *unknowm; + char *piecesFromExt; char *dataPtr; }; |