From b74c0abd8d32b815a095cc5c2068f3ae88b37206 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Tue, 25 Oct 2016 05:43:50 +0000 Subject: [PATCH] Engine: Add vox_undefine(). git-svn-id: https://svn.eduke32.com/eduke32@5914 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/build.h | 1 + polymer/eduke32/build/src/engine.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 0ff128706..34e4da750 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -1029,6 +1029,7 @@ void E_LoadTileIntoBuffer(int16_t tilenume, int32_t dasiz, char *buffer); void E_RenderArtDataIntoBuffer(palette_t * pic, uint8_t const * buf, int32_t bufsizx, int32_t sizx, int32_t sizy); int32_t qloadkvx(int32_t voxindex, const char *filename); +void vox_undefine(int32_t const); intptr_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz); void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2); void makepalookup(int32_t palnum, const char *remapbuf, uint8_t r, uint8_t g, uint8_t b, char noFloorPal); diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 30a0f0075..4ca105620 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -9991,6 +9991,33 @@ int32_t qloadkvx(int32_t voxindex, const char *filename) return 0; } +void vox_undefine(int32_t const tile) +{ + ssize_t voxindex = tiletovox[tile]; + if (voxindex < 0) + return; + +#ifdef USE_OPENGL + if (voxmodels[voxindex]) + { + voxfree(voxmodels[voxindex]); + voxmodels[voxindex] = NULL; + } + DO_FREE_AND_NULL(voxfilenames[voxindex]); +#endif + + for (ssize_t j = 0; j < MAXVOXMIPS; ++j) + { + // CACHE1D_FREE + voxlock[voxindex][j] = 1; + voxoff[voxindex][j] = 0; + } + voxscale[voxindex] = 65536; + tiletovox[tile] = -1; + + // TODO: nextvoxid +} + // // inside //