diff --git a/source/build/include/build.h b/source/build/include/build.h index bcf95d8a9..95d5082db 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -772,7 +772,7 @@ static FORCE_INLINE int32_t getpskyidx(int32_t picnum) return j; } -EXTERN psky_t * E_DefinePsky(int32_t tilenum); +EXTERN psky_t * tileSetupSky(int32_t tilenum); EXTERN char parallaxtype; EXTERN int32_t parallaxyoffs_override, parallaxyscale_override; @@ -1017,37 +1017,37 @@ typedef struct artheader_t { } artheader_t; #define ARTv1_UNITOFFSET ((signed)(4*sizeof(int32_t) + 2*sizeof(int16_t) + sizeof(picanm_t))) -int32_t preinitengine(void); // a partial setup of the engine used for launch windows -int32_t initengine(void); -int32_t E_PostInit(void); -void uninitengine(void); +int32_t enginePreInit(void); // a partial setup of the engine used for launch windows +int32_t engineInit(void); +int32_t enginePostInit(void); +void engineUnInit(void); void initspritelists(void); -int32_t E_FatalError(char const * const msg); +int32_t engineFatalError(char const * const msg); -int32_t loadboard(const char *filename, char flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum); -int32_t loadmaphack(const char *filename); -void delete_maphack_lights(); +int32_t engineLoadBoard(const char *filename, char flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum); +int32_t engineLoadMHK(const char *filename); +void engineClearLightsFromMHK(); #ifdef HAVE_CLIPSHAPE_FEATURE -int32_t clipmapinfo_load(void); +int32_t engineLoadClipMaps(void); #endif int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int16_t dacursectnum); -void tileSetupDummy(int32_t const tile); -void tileSetData(int32_t const tile, int32_t tsiz, char const * const buffer); -void tileDelete(int32_t const tile); -void tileSetSize(int32_t picnum, int16_t dasizx, int16_t dasizy); -int32_t artReadHeader(int32_t const fil, char const * const fn, artheader_t * const local); -int32_t artReadHeaderFromBuffer(uint8_t const * const buf, artheader_t * const local); -int32_t artCheckUnitFileHeader(uint8_t const * const buf, int32_t length); -void tileConvertAnimFormat(int32_t const picnum); -void artReadManifest(int32_t const fil, artheader_t const * const local); -void artPreloadFile(int32_t const fil, artheader_t const * const local); -int32_t artLoadFiles(const char *filename, int32_t askedsize); -void artClearMapArt(void); -void artSetupMapArt(const char *filename); -bool tileLoad(int16_t tilenume); -void tileLoadData(int16_t tilenume, int32_t dasiz, char *buffer); -void artConvertRGB(palette_t * pic, uint8_t const * buf, int32_t bufsizx, int32_t sizx, int32_t sizy); +void tileSetupDummy(int32_t const tile); +void tileSetData(int32_t const tile, int32_t tsiz, char const *const buffer); +void tileDelete(int32_t const tile); +void tileSetSize(int32_t picnum, int16_t dasizx, int16_t dasizy); +int32_t artReadHeader(int32_t const fil, char const *const fn, artheader_t *const local); +int32_t artReadHeaderFromBuffer(uint8_t const *const buf, artheader_t *const local); +int32_t artCheckUnitFileHeader(uint8_t const *const buf, int32_t length); +void tileConvertAnimFormat(int32_t const picnum); +void artReadManifest(int32_t const fil, artheader_t const *const local); +void artPreloadFile(int32_t const fil, artheader_t const *const local); +int32_t artLoadFiles(const char *filename, int32_t askedsize); +void artClearMapArt(void); +void artSetupMapArt(const char *filename); +bool tileLoad(int16_t tilenume); +void tileLoadData(int16_t tilenume, int32_t dasiz, char *buffer); +void artConvertRGB(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); @@ -1059,30 +1059,29 @@ int32_t videoSetGameMode(char davidoption, int32_t daxdim, int32_t daydim, int void videoNextPage(void); void videoSetCorrectedAspect(); void videoSetViewableArea(int32_t x1, int32_t y1, int32_t x2, int32_t y2); -void videoSetAspect(int32_t daxrange, int32_t daaspect); +void renderSetAspect(int32_t daxrange, int32_t daaspect); void flushperms(void); void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, int col) ATTRIBUTE((nonnull(1,2))); void plotpixel(int32_t x, int32_t y, char col); -char getpixel(int32_t x, int32_t y); -void videoSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz); -void videoRestoreTarget(void); -void preparemirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall, +void renderSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz); +void renderRestoreTarget(void); +void renderPrepareMirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall, int32_t *tposx, int32_t *tposy, fix16_t *tang); -void completemirror(void); +void renderCompleteMirror(void); -int32_t drawrooms_q16(int32_t daposx, int32_t daposy, int32_t daposz, fix16_t daang, fix16_t dahoriz, int16_t dacursectnum); +int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz, fix16_t daang, fix16_t dahoriz, int16_t dacursectnum); static FORCE_INLINE int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, int16_t daang, int16_t dahoriz, int16_t dacursectnum) { - return drawrooms_q16(daposx, daposy, daposz, fix16_from_int(daang), fix16_from_int(dahoriz), dacursectnum); + return renderDrawRoomsQ16(daposx, daposy, daposz, fix16_from_int(daang), fix16_from_int(dahoriz), dacursectnum); } -void drawmasks(void); +void renderDrawMasks(void); void videoClearViewableArea(int32_t dacol); void videoClearScreen(int32_t dacol); -void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang); +void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang); void rotatesprite_(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, char dapalnum, int32_t dastat, uint8_t daalpha, uint8_t dablend, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2); @@ -1145,7 +1144,7 @@ void setfirstwall(int16_t sectnum, int16_t newfirstwall); extern const int16_t *chsecptr_onextwall; int32_t checksectorpointer(int16_t i, int16_t sectnum); -void getmousevalues(int32_t *mousx, int32_t *mousy, int32_t *bstatus) ATTRIBUTE((nonnull(1,2,3))); +void mouseGetValues(int32_t *mousx, int32_t *mousy, int32_t *bstatus) ATTRIBUTE((nonnull(1,2,3))); #if !KRANDDEBUG && !defined LUNATIC static FORCE_INLINE int32_t krand(void) @@ -1241,8 +1240,8 @@ static FORCE_INLINE int32_t spriteheightofs(int16_t i, int32_t *height, int32_t return spriteheightofsptr((uspritetype *)&sprite[i], height, alsotileyofs); } -int screencapture(const char *filename, char inverseit) ATTRIBUTE((nonnull(1))); -int screencapture_tga(const char *filename, char inverseit) ATTRIBUTE((nonnull(1))); +int videoCaptureScreen(const char *filename, char inverseit) ATTRIBUTE((nonnull(1))); +int videoCaptureScreenTGA(const char *filename, char inverseit) ATTRIBUTE((nonnull(1))); struct OutputFileCounter { uint16_t count = 0; @@ -1263,17 +1262,17 @@ int32_t wallvisible(int32_t x, int32_t y, int16_t wallnum); //void qsetmode640480(void); void videoSet2dMode(int32_t,int32_t); void clear2dscreen(void); -void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, +void editorDraw2dGrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, int16_t ange, int32_t zoome, int16_t gride); -void draw2dscreen(const vec3_t *pos, int16_t cursectnum, +void editorDraw2dScreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t zoome, int16_t gride) ATTRIBUTE((nonnull(1))); -int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int col); -void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col); +int32_t editorDraw2dLine(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int col); +void editorDraw2dCircle(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col); -int32_t setrendermode(int32_t renderer); +int32_t videoSetRenderMode(int32_t renderer); #ifdef USE_OPENGL -void setrollangle(int32_t rolla); +void renderSetRollAngle(int32_t rolla); #endif // pal: pass -1 to invalidate all palettes for the tile, or >=0 for a particular palette @@ -1287,9 +1286,9 @@ void setrollangle(int32_t rolla); // bit 6: 33% translucence, using clamping // bit 7: 67% translucence, using clamping // clamping is for sprites, repeating is for walls -void invalidatetile(int16_t tilenume, int32_t pal, int32_t how); +void tileInvalidate(int16_t tilenume, int32_t pal, int32_t how); -void setpolymost2dview(void); // sets up GL for 2D drawing +void polymostSet2dView(void); // sets up GL for 2D drawing int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, int32_t dimen, int32_t tilezoom, int32_t usehitile, uint8_t *loadedhitile); @@ -1408,7 +1407,7 @@ int32_t loaddefinitionsfile(const char *fn); // if loadboard() fails with -2 return, try loadoldboard(). if it fails with // -2, board is dodgy -int32_t loadoldboard(const char *filename, char fromwhere, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum); +int32_t engineLoadBoardV5V6(const char *filename, char fromwhere, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum); #ifdef __cplusplus } diff --git a/source/build/include/clip.h b/source/build/include/clip.h index 4c2b5d624..4d0f340d1 100644 --- a/source/build/include/clip.h +++ b/source/build/include/clip.h @@ -55,12 +55,12 @@ typedef struct extern mapinfo_t origmapinfo, clipmapinfo; -extern void clipmapinfo_init(); +extern void engineInitClipMaps(); extern int32_t quickloadboard; extern int16_t *sectq; extern int16_t pictoidx[MAXTILES]; // maps tile num to clipinfo[] index extern int16_t clipspritelist[MAXCLIPNUM]; -extern void mapinfo_set(mapinfo_t *bak, mapinfo_t *newmap); +extern void engineSetClipMap(mapinfo_t *bak, mapinfo_t *newmap); extern int32_t clipsprite_try(uspritetype const * const spr, int32_t xmin, int32_t ymin, int32_t xmax, int32_t ymax); extern int32_t clipsprite_initindex(int32_t curidx, uspritetype const * const curspr, int32_t *clipsectcnt, const vec3_t *vect); diff --git a/source/build/include/colmatch.h b/source/build/include/colmatch.h index 7d413f3c4..71a236637 100644 --- a/source/build/include/colmatch.h +++ b/source/build/include/colmatch.h @@ -13,7 +13,7 @@ extern int32_t getclosestcol_lim(int32_t r, int32_t g, int32_t b, int32_t lastok extern int32_t getclosestcol_nocache_lim(int32_t r, int32_t g, int32_t b, int32_t lastokcol); extern void getclosestcol_flush(void); -static FORCE_INLINE int32_t getclosestcol(int32_t r, int32_t g, int32_t b) +static FORCE_INLINE int32_t paletteGetClosestColor(int32_t r, int32_t g, int32_t b) { return getclosestcol_lim(r, g, b, 255); } diff --git a/source/build/include/editor.h b/source/build/include/editor.h index 7da6cf5d9..fb1a8a5e5 100644 --- a/source/build/include/editor.h +++ b/source/build/include/editor.h @@ -168,11 +168,11 @@ extern int32_t m32_wallscreenxy[MAXWALLS][2]; extern int16_t m32_wallsprite[MAXWALLS+MAXSPRITES]; extern int8_t sideview_reversehrot; extern int32_t scalescreeny(int32_t sy); -extern void screencoords(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome) ATTRIBUTE((nonnull)); +extern void editorGet2dScreenCoordinates(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome) ATTRIBUTE((nonnull)); //extern void invscreencoords(int32_t *dx, int32_t *dy, int32_t sx, int32_t sy, int32_t zoome); extern int32_t getinvdisplacement(int32_t *dx, int32_t *dy, int32_t dz) ATTRIBUTE((nonnull)); extern int32_t getscreenvdisp(int32_t bz, int32_t zoome); -extern void setup_sideview_sincos(void); +extern void editorSetup2dSideView(void); extern int8_t keeptexturestretch; extern int16_t pointhighlightdist, linehighlightdist; @@ -395,7 +395,7 @@ static inline int32_t m32_is2d3dmode(void) searchy > m32_2d3d.y && searchy < (m32_2d3d.y + YSIZE_2D3D); } -extern int32_t getspritecol(int32_t spr); +extern int32_t editorGet2dSpriteColor(int32_t spr); #define NEXTWALL(i) (wall[wall[i].nextwall]) #define POINT2(i) (wall[wall[i].point2]) diff --git a/source/build/src/2d.cpp b/source/build/src/2d.cpp index 294bca656..2c69fe24b 100644 --- a/source/build/src/2d.cpp +++ b/source/build/src/2d.cpp @@ -94,7 +94,7 @@ void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, int co videoBeginDrawing(); for (i=0; i= REND_POLYMOST && in3dmode()) return 0; -#endif - - videoBeginDrawing(); //{{{ - r = readpixel((void *) (ylookup[y]+x+frameplace)); - videoEndDrawing(); //}}} - return r; -} - - // // drawline256 // @@ -276,7 +258,7 @@ void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col) // after clipping or crashes would ensue uint32_t drawlinepat = 0xffffffff; -int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int col) +int32_t editorDraw2dLine(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int col) { //int32_t odx,ody; //int32_t ox1=x1,oy1=y1, ox2=x2,oy2=y2; @@ -432,16 +414,16 @@ int32_t drawline16(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int col) return 1; } -static FORCE_INLINE void drawline16mid(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col) +static FORCE_INLINE void editorDraw2dLineMiddle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col) { - drawline16(halfxdim16+x1, midydim16+y1, halfxdim16+x2, midydim16+y2, col); + editorDraw2dLine(halfxdim16+x1, midydim16+y1, halfxdim16+x2, midydim16+y2, col); } // eccen: eccentricity of the ellipse, // 16384: circle // <16384: shrink in y // >16384: grow in y -void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col) +void editorDraw2dCircle(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col) { if (eccen != 16384) { @@ -456,13 +438,13 @@ void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col) px = x1 + mulscale14(r, sintable[l]); py = y1 + mulscale14(eccen, mulscale14(r, sintable[(l+512)&2047])); - drawline16(lpx, lpy, px, py, col); + editorDraw2dLine(lpx, lpy, px, py, col); lpx = px; lpy = py; } - drawline16(lpx, lpy, spx, spy, col); + editorDraw2dLine(lpx, lpy, spx, spy, col); return; } @@ -609,7 +591,7 @@ void clear2dscreen(void) int32_t scalescreeny(int32_t sy) { return (m32_sideview) ? mulscale14(sy, m32_sidesin) : sy; } // return screen coordinates for BUILD coords x and y (relative to current position) -void screencoords(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome) +void editorGet2dScreenCoordinates(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome) { vec2_t coord = { x, y }; @@ -656,7 +638,7 @@ int32_t getscreenvdisp(int32_t bz, int32_t zoome) return mulscale32(bz, zoome*m32_sidecos); } -void setup_sideview_sincos(void) +void editorSetup2dSideView(void) { if (m32_sideview) { @@ -673,7 +655,7 @@ void setup_sideview_sincos(void) } } -static void sideview_getdist(int16_t sw, int16_t sect) +static void editorGet2dSideViewDistance(int16_t sw, int16_t sect) { vec3_t *p; vec3_t v; @@ -691,7 +673,7 @@ static void sideview_getdist(int16_t sw, int16_t sect) m32_sidedist[sw] = p->x*m32_viewplane.x + p->y*m32_viewplane.y + (p->z>>4)*m32_viewplane.z; } -static int sideview_cmppoints(const void *sw1, const void *sw2) +static int editorCompare2dSideViewPoints(const void *sw1, const void *sw2) { int32_t dist1 = m32_sidedist[B_UNBUF16(sw1)]; int32_t dist2 = m32_sidedist[B_UNBUF16(sw2)]; @@ -710,7 +692,7 @@ static int sideview_cmppoints(const void *sw1, const void *sw2) // // draw2dgrid // -void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, int16_t ange, int32_t zoome, int16_t gride) +void editorDraw2dGrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, int16_t ange, int32_t zoome, int16_t gride) { int64_t i, xp1, yp1, xp2=0, yp2, tempy; @@ -745,10 +727,10 @@ void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, { if (xinc==0) { - screencoords(&sx1, &sy1, -editorgridextent-posxe, yp2-posye, zoome); + editorGet2dScreenCoordinates(&sx1, &sy1, -editorgridextent-posxe, yp2-posye, zoome); if (yp2 == yp1) { - screencoords(&sx2, &sy2, editorgridextent-posxe, yp2-posye, zoome); + editorGet2dScreenCoordinates(&sx2, &sy2, editorgridextent-posxe, yp2-posye, zoome); dx = sx2-sx1; dy = sy2-sy1; } @@ -756,17 +738,17 @@ void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, } else // if (yinc==0) { - screencoords(&sx1, &sy1, xp2-posxe, -editorgridextent-posye, zoome); + editorGet2dScreenCoordinates(&sx1, &sy1, xp2-posxe, -editorgridextent-posye, zoome); if (xp2 == xp1) { - screencoords(&sx2, &sy2, xp2-posxe, editorgridextent-posye, zoome); + editorGet2dScreenCoordinates(&sx2, &sy2, xp2-posxe, editorgridextent-posye, zoome); dx = sx2-sx1; dy = sy2-sy1; } xp2 += xinc; } - i = drawline16(halfxdim16+sx1, midydim16+sy1+yofs, halfxdim16+sx1+dx, midydim16+sy1+dy+yofs, editorcolors[25]); + i = editorDraw2dLine(halfxdim16+sx1, midydim16+sy1+yofs, halfxdim16+sx1+dx, midydim16+sy1+dy+yofs, editorcolors[25]); if (i==0 || (xp2<-editorgridextent || xp2>editorgridextent || yp2<-editorgridextent || yp2>editorgridextent)) { @@ -813,13 +795,13 @@ void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, if (xp1 >= 0) { if (xp1 != xp2) - drawline16(xp1, yp1, xp1, yp2, editorcolors[25]); + editorDraw2dLine(xp1, yp1, xp1, yp2, editorcolors[25]); } } if (i >= editorgridextent && xp1 < xdim) xp2 = xp1; if (xp2 >= 0 && xp2 < xdim) - drawline16(xp2, yp1, xp2, yp2, editorcolors[25]); + editorDraw2dLine(xp2, yp1, xp2, yp2, editorcolors[25]); } // horizontal lines @@ -834,7 +816,7 @@ void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, { if ((yp1 > midydim16-ydim16) && (yp1 <= midydim16)) { - drawline16mid(-xp1, -yp1, -xp2, -yp1, editorcolors[25]); + editorDraw2dLineMiddle(-xp1, -yp1, -xp2, -yp1, editorcolors[25]); tempy = yp1; } } @@ -845,7 +827,7 @@ void draw2dgrid(int32_t posxe, int32_t posye, int32_t posze, int16_t cursectnum, } -static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t posze, int32_t zoome, int32_t grayp) +static void editorDraw2dWall(int32_t i, int32_t posxe, int32_t posye, int32_t posze, int32_t zoome, int32_t grayp) { const walltype *const wal = &wall[i]; @@ -884,8 +866,8 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t int const p2 = wal->point2; int32_t x1, y1, x2, y2; - screencoords(&x1, &y1, wal->x-posxe, wal->y-posye, zoome); - screencoords(&x2, &y2, wall[p2].x-posxe, wall[p2].y-posye, zoome); + editorGet2dScreenCoordinates(&x1, &y1, wal->x-posxe, wal->y-posye, zoome); + editorGet2dScreenCoordinates(&x2, &y2, wall[p2].x-posxe, wall[p2].y-posye, zoome); int64_t const dx = wal->x-wall[p2].x; int64_t const dy = wal->y-wall[p2].y; @@ -930,7 +912,7 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t { fzn = getflorzofslope(wal->nextsector, wal->x, wal->y); // if (i < wall[j].point2) - drawline16mid(x1, y1, x1, y1+getscreenvdisp(fzn-fz, zoome), col); + editorDraw2dLineMiddle(x1, y1, x1, y1+getscreenvdisp(fzn-fz, zoome), col); } #ifdef YAX_ENABLE { @@ -941,7 +923,7 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t int32_t const odrawlinepat = drawlinepat; fz2 = getflorzofslope(sectorofwall(nw), wall[nw].x, wall[nw].y); drawlinepat = 0x11111111; - drawline16mid(x1, y1, x1, y1+getscreenvdisp(fz2-fz, zoome), col); + editorDraw2dLineMiddle(x1, y1, x1, y1+getscreenvdisp(fz2-fz, zoome), col); drawlinepat = odrawlinepat; } } @@ -955,11 +937,11 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t { int32_t const one=(klabs(x2-x1) >= klabs(y2-y1)), no=!one; - drawline16mid(x1+no, y1+one, x2+no, y2+one, col); - drawline16mid(x1-no, y1-one, x2-no, y2-one, col); + editorDraw2dLineMiddle(x1+no, y1+one, x2+no, y2+one, col); + editorDraw2dLineMiddle(x1-no, y1-one, x2-no, y2-one, col); } - drawline16mid(x1, y1, x2, y2, col); + editorDraw2dLineMiddle(x1, y1, x2, y2, col); // Draw height indicators at center of walls if requested and if not in // side-view mode. @@ -969,7 +951,7 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t int32_t dax, day; int32_t const k = getangle(x1-x2, y1-y2); - screencoords(&dax, &day, + editorGet2dScreenCoordinates(&dax, &day, ((wal->x+wall[wal->point2].x)>>1)-posxe, ((wal->y+wall[wal->point2].y)>>1)-posye, zoome); @@ -985,7 +967,7 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t int32_t const dx = mulscale11(sintable[(k+1024 + 1024*bb)&2047], min(4096, zoome)) / 2560; int32_t const dy = scalescreeny(mulscale11(sintable[(k+512 + 1024*bb)&2047], min(4096, zoome)) / 2560); - drawline16mid(dax, day, dax+dx, day+dy, col); + editorDraw2dLineMiddle(dax, day, dax+dx, day+dy, col); } } else if (showheightindicators == 2) @@ -994,7 +976,7 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t int32_t const dx = mulscale11(sintable[(k+2048)&2047], min(4096, zoome)) / 2560; int32_t const dy = scalescreeny(mulscale11(sintable[(k+1536)&2047], min(4096, zoome)) / 2560); - drawline16mid(dax, day, dax+dx, day+dy, col); + editorDraw2dLineMiddle(dax, day, dax+dx, day+dy, col); } } @@ -1029,11 +1011,11 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t } } - drawcircle16(halfxdim16+x1, midydim16+y1, pointsize, 16384, col); + editorDraw2dCircle(halfxdim16+x1, midydim16+y1, pointsize, 16384, col); } } -int32_t getspritecol(int32_t spr) +int32_t editorGet2dSpriteColor(int32_t spr) { int const picnum = sprite[spr].picnum; int pal = sprite[spr].pal; @@ -1072,7 +1054,7 @@ int32_t getspritecol(int32_t spr) return palookup[pal][tilecols[picnum]]; } -static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32_t posze, int32_t zoome) +static void editorDraw2dSprite(int32_t j, int32_t posxe, int32_t posye, int32_t posze, int32_t zoome) { int32_t x1, y1, x2, y2; int col; @@ -1088,7 +1070,7 @@ static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32 if (spr->sectnum<0) col = editorcolors[4]; // red else - col = spritecol ? editorcolors[spritecol] : blocking ? editorcolors[5] : getspritecol(j); + col = spritecol ? editorcolors[spritecol] : blocking ? editorcolors[5] : editorGet2dSpriteColor(j); if (editstatus == 1) { @@ -1108,7 +1090,7 @@ static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32 } } - screencoords(&x1, &y1, spr->x-posxe, spr->y-posye, zoome); + editorGet2dScreenCoordinates(&x1, &y1, spr->x-posxe, spr->y-posye, zoome); // tempint = ((midydim16+y1)*bytesperline)+(halfxdim16+x1)+frameplace; if (m32_sideview) @@ -1120,22 +1102,22 @@ static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32 (midydim16+y1 >= -f) && (midydim16+y1 < ydim16+f)) { if (zoome > 512 && spr->clipdist > 32) - drawcircle16(halfxdim16+x1, midydim16+y1, mulscale14(spr->clipdist<<2, zoome), 16384, col); + editorDraw2dCircle(halfxdim16+x1, midydim16+y1, mulscale14(spr->clipdist<<2, zoome), 16384, col); - drawcircle16(halfxdim16+x1, midydim16+y1, 4, 16384, col); + editorDraw2dCircle(halfxdim16+x1, midydim16+y1, 4, 16384, col); x2 = mulscale11(sintable[(spr->ang+angofs+2560)&2047], zoome) / 768; y2 = mulscale11(sintable[(spr->ang+angofs+2048)&2047], zoome) / 768; y2 = scalescreeny(y2); - drawline16mid(x1, y1, x1+x2, y1+y2, col); + editorDraw2dLineMiddle(x1, y1, x1+x2, y1+y2, col); if (hitblocking) { - drawline16mid(x1, y1+1, x1+x2, y1+y2+1, col); - drawline16mid(x1, y1-1, x1+x2, y1+y2-1, col); - drawline16mid(x1-1, y1, x1+x2-1, y1+y2, col); - drawline16mid(x1+1, y1, x1+x2+1, y1+y2, col); + editorDraw2dLineMiddle(x1, y1+1, x1+x2, y1+y2+1, col); + editorDraw2dLineMiddle(x1, y1-1, x1+x2, y1+y2-1, col); + editorDraw2dLineMiddle(x1-1, y1, x1+x2-1, y1+y2, col); + editorDraw2dLineMiddle(x1+1, y1, x1+x2+1, y1+y2, col); } if (flooraligned) @@ -1164,15 +1146,15 @@ static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32 for (ii=3; ii>=0; ii--) { in = (ii+1)&3; - drawline16mid(x1+co[ii][0], y1-co[ii][1], x1+co[in][0], y1-co[in][1], col); + editorDraw2dLineMiddle(x1+co[ii][0], y1-co[ii][1], x1+co[in][0], y1-co[in][1], col); if (hitblocking) { - drawline16mid(x1+co[ii][0], y1-co[ii][1]+1, x1+co[in][0], y1-co[in][1]+1, col); - drawline16mid(x1+co[ii][0], y1-co[ii][1]-1, x1+co[in][0], y1-co[in][1]-1, col); - drawline16mid(x1+co[ii][0]+1, y1-co[ii][1], x1+co[in][0]+1, y1-co[in][1], col); - drawline16mid(x1+co[ii][0]-1, y1-co[ii][1], x1+co[in][0]-1, y1-co[in][1], col); + editorDraw2dLineMiddle(x1+co[ii][0], y1-co[ii][1]+1, x1+co[in][0], y1-co[in][1]+1, col); + editorDraw2dLineMiddle(x1+co[ii][0], y1-co[ii][1]-1, x1+co[in][0], y1-co[in][1]-1, col); + editorDraw2dLineMiddle(x1+co[ii][0]+1, y1-co[ii][1], x1+co[in][0]+1, y1-co[in][1], col); + editorDraw2dLineMiddle(x1+co[ii][0]-1, y1-co[ii][1], x1+co[in][0]-1, y1-co[in][1], col); } - drawline16mid(x1, y1, x1 + co[in][0], y1 - co[in][1], col); + editorDraw2dLineMiddle(x1, y1, x1 + co[in][0], y1 - co[in][1], col); } drawlinepat = 0xffffffff; } @@ -1185,21 +1167,21 @@ static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32 y2 = mulscale11(sintable[(spr->ang+angofs+2048)&2047], zoome) / 6144; y2 = scalescreeny(y2); - drawline16mid(x1, y1, x1+x2, y1+y2, col); + editorDraw2dLineMiddle(x1, y1, x1+x2, y1+y2, col); if (!(spr->cstat&64)) // not 1-sided { - drawline16mid(x1, y1, x1-x2, y1-y2, col); + editorDraw2dLineMiddle(x1, y1, x1-x2, y1-y2, col); if (hitblocking) { - drawline16mid(x1-no, y1-one, x1-x2-no, y1-y2-one, col); - drawline16mid(x1+no, y1+one, x1-x2+no, y1-y2+one, col); + editorDraw2dLineMiddle(x1-no, y1-one, x1-x2-no, y1-y2-one, col); + editorDraw2dLineMiddle(x1+no, y1+one, x1-x2+no, y1-y2+one, col); } } if (hitblocking) { - drawline16mid(x1-no, y1-one, x1+x2-no, y1+y2-one, col); - drawline16mid(x1+no, y1+one, x1+x2+no, y1+y2+one, col); + editorDraw2dLineMiddle(x1-no, y1-one, x1+x2-no, y1+y2-one, col); + editorDraw2dLineMiddle(x1+no, y1+one, x1+x2+no, y1+y2+one, col); } @@ -1207,20 +1189,20 @@ static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32 y2 = mulscale13(sintable[(spr->ang+angofs+512)&2047], zoome) * fx / 4096; y2 = scalescreeny(y2); - drawline16mid(x1, y1, x1-x2, y1-y2, col); - drawline16mid(x1, y1, x1+x2, y1+y2, col); + editorDraw2dLineMiddle(x1, y1, x1-x2, y1-y2, col); + editorDraw2dLineMiddle(x1, y1, x1+x2, y1+y2, col); if (hitblocking) { - drawline16mid(x1+1, y1, x1+x2+1, y1+y2, col); - drawline16mid(x1-1, y1, x1-x2-1, y1-y2, col); - drawline16mid(x1-1, y1, x1+x2-1, y1+y2, col); - drawline16mid(x1+1, y1, x1-x2+1, y1-y2, col); + editorDraw2dLineMiddle(x1+1, y1, x1+x2+1, y1+y2, col); + editorDraw2dLineMiddle(x1-1, y1, x1-x2-1, y1-y2, col); + editorDraw2dLineMiddle(x1-1, y1, x1+x2-1, y1+y2, col); + editorDraw2dLineMiddle(x1+1, y1, x1-x2+1, y1-y2, col); - drawline16mid(x1, y1-1, x1+x2, y1+y2-1, col); - drawline16mid(x1, y1+1, x1-x2, y1-y2+1, col); - drawline16mid(x1, y1+1, x1+x2, y1+y2+1, col); - drawline16mid(x1, y1-1, x1-x2, y1-y2-1, col); + editorDraw2dLineMiddle(x1, y1-1, x1+x2, y1+y2-1, col); + editorDraw2dLineMiddle(x1, y1+1, x1-x2, y1-y2+1, col); + editorDraw2dLineMiddle(x1, y1+1, x1+x2, y1+y2+1, col); + editorDraw2dLineMiddle(x1, y1-1, x1-x2, y1-y2-1, col); } } } @@ -1232,7 +1214,7 @@ static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32 static int8_t tempbuf[(MAXWALLS+7)>>3]; -void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t zoome, int16_t gride) +void editorDraw2dScreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t zoome, int16_t gride) { int32_t i, x1, y1; int16_t angofs = m32_sideview ? m32_sideang : 0; @@ -1243,7 +1225,7 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z if (in3dmode()) return; - setup_sideview_sincos(); + editorSetup2dSideView(); videoBeginDrawing(); //{{{ @@ -1254,7 +1236,7 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z clear2dscreen(); // faketimerhandler(); - draw2dgrid(posxe, posye, posze, cursectnum, ange, zoome, gride); + editorDraw2dGrid(posxe, posye, posze, cursectnum, ange, zoome, gride); } faketimerhandler(); @@ -1279,16 +1261,16 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z { #ifndef YAX_ENABLE for (i=numwalls-1; i>=0; i--) - drawscreen_drawwall(i, posxe, posye, posze, zoome, 0); + editorDraw2dWall(i, posxe, posye, posze, zoome, 0); #else if (alwaysshowgray) for (i=numwalls-1; i>=0; i--) if (graybitmap[i>>3]&(1<<(i&7))) - drawscreen_drawwall(i, posxe, posye, posze, zoome, 1+2); + editorDraw2dWall(i, posxe, posye, posze, zoome, 1+2); for (i=numwalls-1; i>=0; i--) if ((graybitmap[i>>3]&(1<<(i&7)))==0) - drawscreen_drawwall(i, posxe, posye, posze, zoome, 2); + editorDraw2dWall(i, posxe, posye, posze, zoome, 2); #endif } else @@ -1299,14 +1281,14 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z for (j=sector[i].wallptr; j>3]&(1<<(j&7)))) - drawscreen_drawwall(j, posxe, posye, posze, zoome, !!(graybitmap[j>>3]&(1<<(j&7)))); + editorDraw2dWall(j, posxe, posye, posze, zoome, !!(graybitmap[j>>3]&(1<<(j&7)))); } else { if (!alwaysshowgray && sprite[j-MAXWALLS].sectnum>=0) YAX_SKIPSECTOR(sprite[j-MAXWALLS].sectnum); - drawscreen_drawsprite(j-MAXWALLS, posxe, posye, posze, zoome); + editorDraw2dSprite(j-MAXWALLS, posxe, posye, posze, zoome); } } @@ -1381,9 +1363,9 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z i = scalescreeny(x1); int32_t j = scalescreeny(y1); - drawline16mid(x1, j, -x1, -j, editorcolors[15]); - drawline16mid(x1, j, +y1, -i, editorcolors[15]); - drawline16mid(x1, j, -y1, +i, editorcolors[15]); + editorDraw2dLineMiddle(x1, j, -x1, -j, editorcolors[15]); + editorDraw2dLineMiddle(x1, j, +y1, -i, editorcolors[15]); + editorDraw2dLineMiddle(x1, j, -y1, +i, editorcolors[15]); videoEndDrawing(); //}}} @@ -1393,7 +1375,7 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z // setpolymost2dview // Sets OpenGL for 2D drawing // -void setpolymost2dview(void) +void polymostSet2dView(void) { #ifdef USE_OPENGL if (videoGetRenderMode() < REND_POLYMOST) return; diff --git a/source/build/src/baselayer.cpp b/source/build/src/baselayer.cpp index 115f232ca..bd03c829f 100644 --- a/source/build/src/baselayer.cpp +++ b/source/build/src/baselayer.cpp @@ -319,7 +319,7 @@ static int32_t osdfunc_setrendermode(osdfuncparm_t const * const parm) baselayer_osdcmd_vidmode_func(&parm); } - setrendermode(m); + videoSetRenderMode(m); char const *renderer; diff --git a/source/build/src/build.cpp b/source/build/src/build.cpp index 6e3fcbcb2..d65e10b42 100644 --- a/source/build/src/build.cpp +++ b/source/build/src/build.cpp @@ -531,7 +531,7 @@ void M32_DrawRoomsAndMasks(void) CallExtAnalyzeSprites(0,0,0,0); searchwall = osearchwall, searchstat=osearchstat; - drawmasks(); + renderDrawMasks(); srchwall = (searchstat == 3) ? searchwall : -1; M32_ResetFakeRORTiles(); @@ -541,7 +541,7 @@ void M32_DrawRoomsAndMasks(void) polymer_editorpick(); drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); CallExtAnalyzeSprites(0,0,0,0); - drawmasks(); + renderDrawMasks(); M32_ResetFakeRORTiles(); } #endif @@ -550,14 +550,14 @@ void M32_DrawRoomsAndMasks(void) if (g_doScreenShot) { - screencapture("mcapxxxx.tga", 0); + videoCaptureScreen("mcapxxxx.tga", 0); g_doScreenShot = 0; } if (r_usenewaspect) { newaspect_enable = 0; - videoSetAspect(tmpvr, tmpyx); + renderSetAspect(tmpvr, tmpyx); } } @@ -650,7 +650,7 @@ int app_main(int argc, char const * const * argv) Bstrncpy(game_executable, DefaultGameLocalExec, sizeof(game_executable)); - if (preinitengine()) + if (enginePreInit()) M32_FatalEngineError(); if ((i = CallExtInit()) < 0) return -1; @@ -660,7 +660,7 @@ int app_main(int argc, char const * const * argv) { if (quitevent || !startwin_run()) { - uninitengine(); + engineUnInit(); Bexit(0); } } @@ -691,7 +691,7 @@ int app_main(int argc, char const * const * argv) free(m); g_defModules.clear(); - if (E_PostInit()) + if (enginePostInit()) M32_FatalEngineError(); CallExtPostInit(); @@ -722,7 +722,7 @@ int app_main(int argc, char const * const * argv) cacheAllocateBlock(&waloff[i], sx*sy, &walock[i]); newtile = (char *)waloff[i]; - col = getclosestcol(128, 128, 0); + col = paletteGetClosestColor(128, 128, 0); for (j=0; j<(signed)sizeof(R); j++) R[j] *= col; @@ -733,7 +733,7 @@ int app_main(int argc, char const * const * argv) #endif #ifdef HAVE_CLIPSHAPE_FEATURE - int k = clipmapinfo_load(); + int k = engineLoadClipMaps(); if (k>0) initprintf("There was an error loading the sprite clipping map (status %d).\n", k); @@ -772,7 +772,7 @@ int app_main(int argc, char const * const * argv) if (videoSetGameMode(fullscreen, xdim2d, ydim2d, 8) < 0) { CallExtUnInit(); - uninitengine(); + engineUnInit(); Bprintf("%d * %d not supported in this graphics mode\n",xdim2d,ydim2d); Bexit(0); } @@ -795,7 +795,7 @@ int app_main(int argc, char const * const * argv) if (videoSetGameMode(fullscreen, xdimgame, ydimgame, bppgame) < 0) { CallExtUnInit(); - uninitengine(); + engineUnInit(); Bprintf("%d * %d not supported in this graphics mode\n",xdim,ydim); Bexit(0); } @@ -913,7 +913,7 @@ CANCEL: CallExtUnInit(); // clearfilenames(); - uninitengine(); + engineUnInit(); return 0; } @@ -929,7 +929,7 @@ static void loadmhk(int32_t domessage) Bstrcpy(levname, boardfilename); append_ext_UNSAFE(levname, ".mhk"); - if (!loadmaphack(levname)) + if (!engineLoadMHK(levname)) { if (domessage) message("Loaded map hack file \"%s\"",levname); @@ -1092,7 +1092,7 @@ void editinput(void) // F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL mousz = 0; - getmousevalues(&mousx,&mousy,&bstatus); + mouseGetValues(&mousx,&mousy,&bstatus); mousx = (mousx<<16) + mousexsurp; mousy = (mousy<<16) + mouseysurp; @@ -1228,7 +1228,7 @@ void editinput(void) { Bmemset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); Bmemset(spritesmooth, 0, sizeof(spritesmooth_t) * (MAXSPRITES+MAXUNIQHUDID)); - delete_maphack_lights(); + engineClearLightsFromMHK(); mhk = 0; message("Maphacks disabled"); } @@ -1562,7 +1562,7 @@ static int32_t inside_editor(const vec3_t *pos, int32_t searchx, int32_t searchy { wall[i].point2 += dstw-srcw; - screencoords(&wall[i].x, &wall[i].y, wall[i].x-pos->x, wall[i].y-pos->y, zoom); + editorGet2dScreenCoordinates(&wall[i].x, &wall[i].y, wall[i].x-pos->x, wall[i].y-pos->y, zoom); wall[i].y += getscreenvdisp(getflorzofslope(sectnum,wall[oi].x,wall[oi].y)-pos->z, zoom); wall[i].x += halfxdim16; wall[i].y += midydim16; @@ -1585,12 +1585,12 @@ int32_t inside_editor_curpos(int16_t sectnum) static inline void drawline16base(int32_t bx, int32_t by, int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col) { - drawline16(bx+x1, by+y1, bx+x2, by+y2, col); + editorDraw2dLine(bx+x1, by+y1, bx+x2, by+y2, col); } void drawsmallabel(const char *text, char col, char backcol, char border, int32_t dax, int32_t day, int32_t daz) { - screencoords(&dax,&day, dax-pos.x,day-pos.y, zoom); + editorGet2dScreenCoordinates(&dax,&day, dax-pos.x,day-pos.y, zoom); if (m32_sideview) day += getscreenvdisp(daz-pos.z, zoom); @@ -1607,18 +1607,18 @@ void drawsmallabel(const char *text, char col, char backcol, char border, int32_ printext16(x1,y1, col,backcol, text,1); - drawline16(x1-2, y1-2, x2-2, y1-2, border); - drawline16(x1-2, y2+1, x2-2, y2+1, border); + editorDraw2dLine(x1-2, y1-2, x2-2, y1-2, border); + editorDraw2dLine(x1-2, y2+1, x2-2, y2+1, border); - drawline16(x1-3, y1-1, x1-3, y2+0, border); - drawline16(x2-1, y1-1, x2-1, y2+0, border); + editorDraw2dLine(x1-3, y1-1, x1-3, y2+0, border); + editorDraw2dLine(x2-1, y1-1, x2-1, y2+0, border); - drawline16(x1-1,y1-1, x2-3,y1-1, backcol); - drawline16(x1-1,y2+0, x2-3,y2+0, backcol); + editorDraw2dLine(x1-1,y1-1, x2-3,y1-1, backcol); + editorDraw2dLine(x1-1,y2+0, x2-3,y2+0, backcol); - drawline16(x1-2,y1+0, x1-2,y2-1, backcol); - drawline16(x2-2,y1+0, x2-2,y2-1, backcol); - drawline16(x2-3,y1+0, x2-3,y2+0, backcol); + editorDraw2dLine(x1-2,y1+0, x1-2,y2-1, backcol); + editorDraw2dLine(x2-2,y1+0, x2-2,y2-1, backcol); + editorDraw2dLine(x2-3,y1+0, x2-3,y2+0, backcol); videoBeginDrawing(); //{{{ @@ -3230,8 +3230,8 @@ static void drawlinebetween(const vec3_t *v1, const vec3_t *v2, int32_t col, uin int32_t x1, x2, y1, y2; - screencoords(&x1,&y1, v1->x-pos.x,v1->y-pos.y, zoom); - screencoords(&x2,&y2, v2->x-pos.x,v2->y-pos.y, zoom); + editorGet2dScreenCoordinates(&x1,&y1, v1->x-pos.x,v1->y-pos.y, zoom); + editorGet2dScreenCoordinates(&x2,&y2, v2->x-pos.x,v2->y-pos.y, zoom); if (m32_sideview) { @@ -3240,7 +3240,7 @@ static void drawlinebetween(const vec3_t *v1, const vec3_t *v2, int32_t col, uin } drawlinepat = pat; - drawline16(xofs+x1,yofs+y1, xofs+x2,yofs+y2, col); + editorDraw2dLine(xofs+x1,yofs+y1, xofs+x2,yofs+y2, col); drawlinepat = opat; } @@ -3307,7 +3307,7 @@ static void drawspritelabel(int i) // KEEPINSYNC drawscreen_drawsprite() uspritetype const * s = (uspritetype *)&sprite[i]; uint8_t const spritecol = spritecol2d[s->picnum][(s->cstat&1)]; - int col = spritecol ? editorcolors[spritecol] : getspritecol(i); + int col = spritecol ? editorcolors[spritecol] : editorGet2dSpriteColor(i); int const blocking = s->cstat & 1; int bordercol = blocking ? editorcolors[5] : col; @@ -3459,7 +3459,7 @@ void overheadeditor(void) if (!m32_is2d3dmode()) { oldmousebstatus = bstatus; - getmousevalues(&mousx, &mousy, &bstatus); + mouseGetValues(&mousx, &mousy, &bstatus); { int32_t bs = bstatus; @@ -3513,7 +3513,7 @@ void overheadeditor(void) clear2dscreen(); - setup_sideview_sincos(); + editorSetup2dSideView(); VM_OnEvent(EVENT_PREDRAW2DSCREEN, -1); @@ -3531,15 +3531,15 @@ void overheadeditor(void) if (graphicsmode == 2) totalclocklock = totalclock; - drawmapview(pos.x, pos.y, zoom, m32_sideview ? (3584 - m32_sideang) & 2047: 1536); + renderDrawMapView(pos.x, pos.y, zoom, m32_sideview ? (3584 - m32_sideang) & 2047: 1536); } - draw2dgrid(pos.x,pos.y,pos.z,cursectnum,ang,zoom,grid); + editorDraw2dGrid(pos.x,pos.y,pos.z,cursectnum,ang,zoom,grid); CallExtPreCheckKeys(); - draw2dscreen(&pos,cursectnum,ang,zoom,grid); + editorDraw2dScreen(&pos,cursectnum,ang,zoom,grid); // Draw brown arrow (start) - screencoords(&x2, &y2, startpos.x-pos.x,startpos.y-pos.y, zoom); + editorGet2dScreenCoordinates(&x2, &y2, startpos.x-pos.x,startpos.y-pos.y, zoom); if (m32_sideview) y2 += getscreenvdisp(startpos.z-pos.z, zoom); @@ -3684,8 +3684,8 @@ void overheadeditor(void) if (!m32_is2d3dmode() && (m32_sideview || highlightcnt <= 0)) { drawlinepat = 0x00ff00ff; - drawline16(searchx,0, searchx,ydim2d-1, editorcolors[15]); - drawline16(0,searchy, xdim2d-1,searchy, editorcolors[15]); + editorDraw2dLine(searchx,0, searchx,ydim2d-1, editorcolors[15]); + editorDraw2dLine(0,searchy, xdim2d-1,searchy, editorcolors[15]); drawlinepat = 0xffffffff; _printmessage16("(%d,%d)",mousxplc,mousyplc); @@ -3840,8 +3840,8 @@ void overheadeditor(void) } } - drawline16(searchx,0, searchx,8, editorcolors[15]); - drawline16(0,searchy, 8,searchy, editorcolors[15]); + editorDraw2dLine(searchx,0, searchx,8, editorcolors[15]); + editorDraw2dLine(0,searchy, 8,searchy, editorcolors[15]); // 2d3d mode if (m32_2d3dmode && m32_2d3d_resolutions_match()) @@ -3897,10 +3897,10 @@ void overheadeditor(void) searchy = osearch.y; videoBeginDrawing(); - drawline16(m32_2d3d.x, m32_2d3d.y, m32_2d3d.x + XSIZE_2D3D, m32_2d3d.y, editorcolors[15]); - drawline16(m32_2d3d.x + XSIZE_2D3D, m32_2d3d.y, m32_2d3d.x + XSIZE_2D3D, m32_2d3d.y + YSIZE_2D3D, editorcolors[15]); - drawline16(m32_2d3d.x, m32_2d3d.y, m32_2d3d.x, m32_2d3d.y + YSIZE_2D3D, editorcolors[15]); - drawline16(m32_2d3d.x, m32_2d3d.y + YSIZE_2D3D, m32_2d3d.x + XSIZE_2D3D, m32_2d3d.y + YSIZE_2D3D, editorcolors[15]); + editorDraw2dLine(m32_2d3d.x, m32_2d3d.y, m32_2d3d.x + XSIZE_2D3D, m32_2d3d.y, editorcolors[15]); + editorDraw2dLine(m32_2d3d.x + XSIZE_2D3D, m32_2d3d.y, m32_2d3d.x + XSIZE_2D3D, m32_2d3d.y + YSIZE_2D3D, editorcolors[15]); + editorDraw2dLine(m32_2d3d.x, m32_2d3d.y, m32_2d3d.x, m32_2d3d.y + YSIZE_2D3D, editorcolors[15]); + editorDraw2dLine(m32_2d3d.x, m32_2d3d.y + YSIZE_2D3D, m32_2d3d.x + XSIZE_2D3D, m32_2d3d.y + YSIZE_2D3D, editorcolors[15]); } } @@ -4168,7 +4168,7 @@ void overheadeditor(void) { keystatus[88] = 0; //__clearscreen_beforecapture__ - screencapture("captxxxx.tga", eitherSHIFT); + videoCaptureScreen("captxxxx.tga", eitherSHIFT); videoShowFrame(1); } @@ -5071,7 +5071,7 @@ end_yax: ; } else { - screencoords(&tx,&ty, wall[i].x-pos.x,wall[i].y-pos.y, zoom); + editorGet2dScreenCoordinates(&tx,&ty, wall[i].x-pos.x,wall[i].y-pos.y, zoom); ty += getscreenvdisp( getflorzofslope(sectorofwall(i), wall[i].x,wall[i].y)-pos.z, zoom); tx += halfxdim16; @@ -5120,7 +5120,7 @@ end_yax: ; } else { - screencoords(&tx,&ty, sprite[i].x-pos.x,sprite[i].y-pos.y, zoom); + editorGet2dScreenCoordinates(&tx,&ty, sprite[i].x-pos.x,sprite[i].y-pos.y, zoom); ty += getscreenvdisp(sprite[i].z-pos.z, zoom); tx += halfxdim16; ty += midydim16; @@ -5439,7 +5439,7 @@ end_autoredwall: } else { - screencoords(&tx,&ty, wall[j].x-pos.x,wall[j].y-pos.y, zoom); + editorGet2dScreenCoordinates(&tx,&ty, wall[j].x-pos.x,wall[j].y-pos.y, zoom); ty += getscreenvdisp(getflorzofslope(i, wall[j].x,wall[j].y)-pos.z, zoom); tx += halfxdim16; ty += midydim16; @@ -8230,7 +8230,7 @@ CANCEL: CallExtUnInit(); // clearfilenames(); - uninitengine(); + engineUnInit(); Bexit(0); } @@ -8266,7 +8266,7 @@ CANCEL: initprintf("%d * %d not supported in this graphics mode\n",xdim,ydim); CallExtUnInit(); // clearfilenames(); - uninitengine(); + engineUnInit(); Bexit(1); } @@ -8464,9 +8464,9 @@ int32_t LoadBoard(const char *filename, uint32_t flags) editorzrange[1] = INT32_MAX; CallExtPreLoadMap(); - i = loadboard(filename, (flags&4)|loadingflags, &pos, &ang, &cursectnum); + i = engineLoadBoard(filename, (flags&4)|loadingflags, &pos, &ang, &cursectnum); if (i == -2) - i = loadoldboard(filename,loadingflags, &pos, &ang, &cursectnum); + i = engineLoadBoardV5V6(filename,loadingflags, &pos, &ang, &cursectnum); if (i < 0) { @@ -8641,7 +8641,7 @@ int32_t getpointhighlight(int32_t xplc, int32_t yplc, int32_t point) dst = klabs(xplc-wall[j].x) + klabs(yplc-wall[j].y); else { - screencoords(&dax,&day, wall[j].x-pos.x,wall[j].y-pos.y, zoom); + editorGet2dScreenCoordinates(&dax,&day, wall[j].x-pos.x,wall[j].y-pos.y, zoom); day += getscreenvdisp(getflorzofslope(i, wall[j].x,wall[j].y)-pos.z, zoom); if (halfxdim16+dax < 0 || halfxdim16+dax >= xdim || midydim16+day < 0 || midydim16+day >= ydim) @@ -8672,7 +8672,7 @@ int32_t getpointhighlight(int32_t xplc, int32_t yplc, int32_t point) } else { - screencoords(&dax,&day, sprite[i].x-pos.x,sprite[i].y-pos.y, zoom); + editorGet2dScreenCoordinates(&dax,&day, sprite[i].x-pos.x,sprite[i].y-pos.y, zoom); day += getscreenvdisp(sprite[i].z-pos.z, zoom); if (halfxdim16+dax < 0 || halfxdim16+dax >= xdim || midydim16+day < 0 || midydim16+day >= ydim) @@ -10033,7 +10033,7 @@ int32_t fillsector_maybetrans(int16_t sectnum, int32_t fillcolor, uint8_t dotran endwall = startwall + sector[sectnum].wallnum - 1; for (z=startwall; z<=endwall; z++) { - screencoords(&x1,&y1, wall[z].x-pos.x,wall[z].y-pos.y, zoom); + editorGet2dScreenCoordinates(&x1,&y1, wall[z].x-pos.x,wall[z].y-pos.y, zoom); if (m32_sideview) y1 += getscreenvdisp(getflorzofslope(sectnum,wall[z].x,wall[z].y)-pos.z, zoom); @@ -10128,7 +10128,7 @@ int32_t fillsector_maybetrans(int16_t sectnum, int32_t fillcolor, uint8_t dotran if (fillist[z+1] > rborder) fillist[z+1] = rborder; - drawline16(fillist[z]+1,sy, fillist[z+1]-1,sy, dotrans ? -col : col); //editorcolors[fillcolor] + editorDraw2dLine(fillist[z]+1,sy, fillist[z+1]-1,sy, dotrans ? -col : col); //editorcolors[fillcolor] } } } diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index b93028797..3bd493c14 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -13,7 +13,7 @@ static int16_t clipobjectval[MAXCLIPNUM]; ////// sector-like clipping for sprites ////// #ifdef HAVE_CLIPSHAPE_FEATURE -void mapinfo_set(mapinfo_t *bak, mapinfo_t *newmap) +void engineSetClipMap(mapinfo_t *bak, mapinfo_t *newmap) { if (bak) { @@ -49,7 +49,7 @@ static uwalltype *loadwall, *loadwallinv; static uspritetype *loadsprite; -void clipmapinfo_init() +void engineInitClipMaps() { numclipmaps = 0; numclipsects = 0; @@ -72,7 +72,7 @@ void clipmapinfo_init() // loads the clip maps. // this should be called before any real map is loaded. -int32_t clipmapinfo_load(void) +int32_t engineLoadClipMaps(void) { int32_t i, k, w; @@ -85,7 +85,7 @@ int32_t clipmapinfo_load(void) int32_t ournumsectors=0, ournumwalls=0, ournumsprites=0; - clipmapinfo_init(); + engineInitClipMaps(); loadsector = (usectortype *) Xmalloc(MAXSECTORS * sizeof(sectortype)); loadwall = (uwalltype *) Xmalloc(MAXWALLS * sizeof(walltype)); @@ -105,7 +105,7 @@ int32_t clipmapinfo_load(void) fisec[fi] = ournumsectors; fispr[fi] = ournumsprites; - i = loadboard(g_clipMapFiles[fi], 8, &tmppos, &ang, &cs); + i = engineLoadBoard(g_clipMapFiles[fi], 8, &tmppos, &ang, &cs); if (i<0) continue; // Numsprites will now be set! @@ -148,7 +148,7 @@ int32_t clipmapinfo_load(void) if (ournumsectors==0 || ournumwalls==0 || ournumsprites==0) // nothing loaded { - clipmapinfo_init(); + engineInitClipMaps(); Bfree(fisec); Bfree(fispr); @@ -234,7 +234,7 @@ int32_t clipmapinfo_load(void) initprintf("clip map \"%s\": error: tried to chain picnum %d (sprite %d) in sector %d which" " already belongs to picnum %d.\n", g_clipMapFiles[fi], pn, i-fispr[fi], k-fisec[fi], clipinfo[sectoidx[k]].picnum); - clipmapinfo_init(); + engineInitClipMaps(); Bfree(fisec); Bfree(fispr); @@ -298,7 +298,7 @@ int32_t clipmapinfo_load(void) break; initprintf("clip map \"%s\": error: encountered more than one outer sector (%d and %d)" " for sprite %d.\n", g_clipMapFiles[fi], outersect-fisec[fi], ns-fisec[fi], i-fispr[fi]); - clipmapinfo_init(); + engineInitClipMaps(); Bfree(fisec); Bfree(fispr); @@ -317,7 +317,7 @@ int32_t clipmapinfo_load(void) initprintf("clip map \"%s\": error: encountered sector %d belonging to index %d" " while collecting sectors for sprite %d (index %d).\n", g_clipMapFiles[fi], ns-fisec[fi], sectoidx[ns], i-fispr[fi], numclipmaps); - clipmapinfo_init(); + engineInitClipMaps(); Bfree(fisec); Bfree(fispr); @@ -331,7 +331,7 @@ int32_t clipmapinfo_load(void) if (outersect==-1) { initprintf("clip map: INTERNAL ERROR: outersect==-1!\n"); - clipmapinfo_init(); + engineInitClipMaps(); Bfree(fisec); Bfree(fispr); @@ -916,7 +916,7 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum, Bmemcpy(origclipsectorlist, clipsectorlist, clipsectnum*sizeof(clipsectorlist[0])); // replace sector and wall with clip map - mapinfo_set(&origmapinfo, &clipmapinfo); + engineSetClipMap(&origmapinfo, &clipmapinfo); } curspr = (uspritetype *)&sprite[clipspritelist[clipspritecnt]]; @@ -1175,7 +1175,7 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum, if (curspr) { // restore original map - mapinfo_set(NULL, &origmapinfo); + engineSetClipMap(NULL, &origmapinfo); clipsectnum = origclipsectnum; Bmemcpy(clipsectorlist, origclipsectorlist, clipsectnum*sizeof(clipsectorlist[0])); diff --git a/source/build/src/common.cpp b/source/build/src/common.cpp index a16007798..aa6da11d8 100644 --- a/source/build/src/common.cpp +++ b/source/build/src/common.cpp @@ -250,7 +250,7 @@ void COMMON_clearbackground(int32_t numcols, int32_t numrows) polymost_setFogEnabled(false); polymost_useColorOnly(true); - setpolymost2dview(); + polymostSet2dView(); glColor4f(0.f, 0.f, 0.f, 0.67f); glEnable(GL_BLEND); glRecti(0, 0, xdim, 8*numrows+8); diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp index 04833d785..50d92b451 100644 --- a/source/build/src/defs.cpp +++ b/source/build/src/defs.cpp @@ -2679,7 +2679,7 @@ static int32_t defsparser(scriptfile *script) break; } - psky_t * const newpsky = E_DefinePsky(tile); + psky_t * const newpsky = tileSetupSky(tile); while (script->textptr < blockend) { diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index d2933ac28..2dd9154d0 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -195,9 +195,9 @@ int32_t circlewall=-1; #ifdef __cplusplus extern "C" { #endif -void setup_sideview_sincos(void); +void editorSetup2dSideView(void); int32_t getscreenvdisp(int32_t bz, int32_t zoome); -void screencoords(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome); +void editorGet2dScreenCoordinates(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome); int32_t scalescreeny(int32_t sy); #ifdef YAX_ENABLE void yax_tweakpicnums(int32_t bunchnum, int32_t cf, int32_t restore); @@ -977,7 +977,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), int32_t odsprcnt = yax_spritesortcnt[yax_globallev]; #endif // +MAXSECTORS: force - drawrooms_q16(globalposx,globalposy,globalposz,qglobalang,horiz,k+MAXSECTORS); + renderDrawRoomsQ16(globalposx,globalposy,globalposz,qglobalang,horiz,k+MAXSECTORS); if (numhere > 1) for (i=0; i<(numsectors+7)>>3; i++) lgotsector[i] |= gotsector[i]; @@ -1055,7 +1055,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), for (nmp=r_tror_nomaskpass; nmp>=0; nmp--) { yax_nomaskpass = nmp; - drawrooms_q16(globalposx,globalposy,globalposz,qglobalang,horiz,k+MAXSECTORS); // +MAXSECTORS: force + renderDrawRoomsQ16(globalposx,globalposy,globalposz,qglobalang,horiz,k+MAXSECTORS); // +MAXSECTORS: force if (nmp==1) { @@ -1080,7 +1080,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), (double)(1000*(timerGetTicksU64()-t))/u64tickspersec); SpriteAnimFunc(globalposx, globalposy, globalang, smoothr); - drawmasks(); + renderDrawMasks(); } if (lev < maxlev[cf]) @@ -1098,7 +1098,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), scansector_collectsprites = 0; // draw base level - drawrooms_q16(globalposx,globalposy,globalposz,qglobalang,horiz, + renderDrawRoomsQ16(globalposx,globalposy,globalposz,qglobalang,horiz, osectnum + MAXSECTORS*didmirror); // if (scansector_collectsprites) // spritesortcnt = 0; @@ -1119,8 +1119,8 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t), #ifdef YAX_DEBUG_YMOSTS if (videoGetRenderMode() == REND_CLASSIC && numyaxbunches>0) { - char purple = getclosestcol(255, 0, 255); - char yellow = getclosestcol(255, 255, 0); + char purple = paletteGetClosestColor(255, 0, 255); + char yellow = paletteGetClosestColor(255, 255, 0); videoBeginDrawing(); for (i=0; i= 10); } -static void prepare_loadboard(int32_t fil, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum) +static void enginePrepareLoadBoard(int32_t fil, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum) { initspritelists(); @@ -8996,7 +8996,7 @@ static void prepare_loadboard(int32_t fil, vec3_t *dapos, int16_t *daang, int16_ } } -static int32_t finish_loadboard(const vec3_t *dapos, int16_t *dacursectnum, int16_t numsprites, char myflags) +static int32_t engineFinishLoadBoard(const vec3_t *dapos, int16_t *dacursectnum, int16_t numsprites, char myflags) { int32_t i, realnumsprites=numsprites, numremoved; @@ -9140,7 +9140,7 @@ LUNATIC_CB int32_t (*loadboard_maptext)(int32_t fil, vec3_t *dapos, int16_t *daa // -2: invalid version // -3: invalid number of sectors, walls or sprites // <= -4: map-text error -int32_t loadboard(const char *filename, char flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum) +int32_t engineLoadBoard(const char *filename, char flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum) { int32_t fil, i; int16_t numsprites; @@ -9189,7 +9189,7 @@ int32_t loadboard(const char *filename, char flags, vec3_t *dapos, int16_t *daan } } - prepare_loadboard(fil, dapos, daang, dacursectnum); + enginePrepareLoadBoard(fil, dapos, daang, dacursectnum); #ifdef NEW_MAP_FORMAT if (have_maptext()) @@ -9342,7 +9342,7 @@ skip_reading_mapbin: // initprintf("Loaded map \"%s\" (md4sum: %08x%08x%08x%08x)\n", filename, B_BIG32(*((int32_t*)&md4out[0])), B_BIG32(*((int32_t*)&md4out[4])), B_BIG32(*((int32_t*)&md4out[8])), B_BIG32(*((int32_t*)&md4out[12]))); - return finish_loadboard(dapos, dacursectnum, numsprites, myflags); + return engineFinishLoadBoard(dapos, dacursectnum, numsprites, myflags); } @@ -9353,7 +9353,7 @@ skip_reading_mapbin: // Powerslave uses v6 // Witchaven 1 and TekWar and LameDuke use v5 -int32_t loadoldboard(const char *filename, char fromwhere, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum) +int32_t engineLoadBoardV5V6(const char *filename, char fromwhere, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum) { int32_t fil, i; int16_t numsprites; @@ -9371,7 +9371,7 @@ int32_t loadoldboard(const char *filename, char fromwhere, vec3_t *dapos, int16_ kread(fil,&mapversion,4); mapversion = B_LITTLE32(mapversion); if (mapversion != 5L && mapversion != 6L) { kclose(fil); return -2; } - prepare_loadboard(fil, dapos, daang, dacursectnum); + enginePrepareLoadBoard(fil, dapos, daang, dacursectnum); kread(fil,&numsectors,2); numsectors = B_LITTLE16(numsectors); if (numsectors > MAXSECTORS) { kclose(fil); return -1; } @@ -9528,7 +9528,7 @@ int32_t loadoldboard(const char *filename, char fromwhere, vec3_t *dapos, int16_ kclose(fil); // Done reading file. - return finish_loadboard(dapos, dacursectnum, numsprites, 0); + return engineFinishLoadBoard(dapos, dacursectnum, numsprites, 0); } @@ -10734,7 +10734,7 @@ restart_grand: { // one bunch of sectors completed, prepare the next if (!curspr) - mapinfo_set(&origmapinfo, &clipmapinfo); // replace sector and wall with clip map + engineSetClipMap(&origmapinfo, &clipmapinfo); // replace sector and wall with clip map curspr = (uspritetype *)&sprite[clipspritelist[clipspritecnt]]; curidx = clipshape_idx_for_sprite(curspr, curidx); @@ -10965,7 +10965,7 @@ restart_grand: #ifdef HAVE_CLIPSHAPE_FEATURE if (curspr) - mapinfo_set(NULL, &origmapinfo); + engineSetClipMap(NULL, &origmapinfo); #endif #ifdef YAX_ENABLE @@ -11513,7 +11513,7 @@ void rotatepoint(vec2_t const pivot, vec2_t p, int16_t daang, vec2_t *p2) // getmousevalues // -void getmousevalues(int32_t *mousx, int32_t *mousy, int32_t *bstatus) +void mouseGetValues(int32_t *mousx, int32_t *mousy, int32_t *bstatus) { mouseReadPos(mousx,mousy); mouseReadButtons(bstatus); @@ -11635,7 +11635,7 @@ void getzrange(const vec3_t *pos, int16_t sectnum, { beginagain: // replace sector and wall with clip map - mapinfo_set(&origmapinfo, &clipmapinfo); + engineSetClipMap(&origmapinfo, &clipmapinfo); clipsectcnt = clipsectnum; // should be a nop, "safety"... } #endif @@ -11804,7 +11804,7 @@ restart_grand: #ifdef HAVE_CLIPSHAPE_FEATURE if (curspr) { - mapinfo_set(NULL, &origmapinfo); // restore original map + engineSetClipMap(NULL, &origmapinfo); // restore original map clipsectnum = clipspritenum = 0; // skip the next for loop and check afterwards } #endif @@ -12048,10 +12048,10 @@ void videoSetCorrectedAspect() vr = divscale16(x*3, y*4); - videoSetAspect(vr, yx); + renderSetAspect(vr, yx); } else - videoSetAspect(65536, divscale16(ydim*320, xdim*200)); + renderSetAspect(65536, divscale16(ydim*320, xdim*200)); } // @@ -12085,7 +12085,7 @@ void videoSetViewableArea(int32_t x1, int32_t y1, int32_t x2, int32_t y2) // // setaspect // -void videoSetAspect(int32_t daxrange, int32_t daaspect) +void renderSetAspect(int32_t daxrange, int32_t daaspect) { viewingrange = daxrange; viewingrangerecip = divscale32(1,daxrange); @@ -12282,7 +12282,7 @@ void videoClearScreen(int32_t dacol) // // setviewtotile // -void videoSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz) +void renderSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz) { //DRAWROOMS TO TILE BACKUP&SET CODE tilesiz[tilenume].x = xsiz; tilesiz[tilenume].y = ysiz; @@ -12309,7 +12309,7 @@ void videoSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz) offscreenrendering = 1; videoSetViewableArea(0,0,ysiz-1,xsiz-1); - videoSetAspect(65536,65536); + renderSetAspect(65536,65536); calc_ylookup(ysiz, xsiz); } @@ -12318,7 +12318,7 @@ void videoSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz) // // setviewback // -void videoRestoreTarget(void) +void renderRestoreTarget(void) { if (setviewcnt <= 0) return; setviewcnt--; @@ -12328,7 +12328,7 @@ void videoRestoreTarget(void) if (setviewcnt == 0) { rendmode = bakrendmode; - invalidatetile(baktile,-1,-1); + tileInvalidate(baktile,-1,-1); } #endif @@ -12384,8 +12384,8 @@ void squarerotatetile(int16_t tilenume) // // preparemirror // -void preparemirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall, - int32_t *tposx, int32_t *tposy, fix16_t *tang) +void renderPrepareMirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall, + int32_t *tposx, int32_t *tposy, fix16_t *tang) { const int32_t x = wall[dawall].x, dx = wall[wall[dawall].point2].x-x; const int32_t y = wall[dawall].y, dy = wall[wall[dawall].point2].y-y; @@ -12407,7 +12407,7 @@ void preparemirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall, // // completemirror // -void completemirror(void) +void renderCompleteMirror(void) { #ifdef USE_OPENGL if (videoGetRenderMode() != REND_CLASSIC) @@ -13084,7 +13084,7 @@ static void PolymerProcessModels(void) // // setrendermode // -int32_t setrendermode(int32_t renderer) +int32_t videoSetRenderMode(int32_t renderer) { UNREFERENCED_PARAMETER(renderer); @@ -13104,7 +13104,7 @@ int32_t setrendermode(int32_t renderer) } else if (videoGetRenderMode() == REND_POLYMER) // going from Polymer to another renderer { - delete_maphack_lights(); + engineClearLightsFromMHK(); G_Polymer_UnInit(); polymer_uninit(); } @@ -13131,7 +13131,7 @@ int32_t setrendermode(int32_t renderer) // setrollangle // #ifdef USE_OPENGL -void setrollangle(int32_t rolla) +void renderSetRollAngle(int32_t rolla) { gtang = (float)rolla * (fPI * (1.f/1024.f)); } @@ -13152,7 +13152,7 @@ void setrollangle(int32_t rolla) // bit 7: ignored (67% translucence, using clamping) // clamping is for sprites, repeating is for walls // -void invalidatetile(int16_t tilenume, int32_t pal, int32_t how) +void tileInvalidate(int16_t tilenume, int32_t pal, int32_t how) { #if !defined USE_OPENGL UNREFERENCED_PARAMETER(tilenume); diff --git a/source/build/src/lunatic.cpp b/source/build/src/lunatic.cpp index 83aaedacf..8d3bb4572 100644 --- a/source/build/src/lunatic.cpp +++ b/source/build/src/lunatic.cpp @@ -142,7 +142,7 @@ void L_DestroyState(L_State *estate) static void L_OnOutOfMem(void) { OSD_Printf("Out of memory in Lunatic.\n"); - uninitengine(); + engineUnInit(); exit(127); } diff --git a/source/build/src/mhk.cpp b/source/build/src/mhk.cpp index 03c960a46..eeddd6917 100644 --- a/source/build/src/mhk.cpp +++ b/source/build/src/mhk.cpp @@ -17,7 +17,7 @@ int32_t num_usermaphacks; static int16_t maphacklightcnt=0; static int16_t maphacklight[PR_MAXLIGHTS]; -void delete_maphack_lights() +void engineClearLightsFromMHK() { int32_t i; for (i=0; i= 0) - preparemirror(globalposx, globalposy, qglobalang, + renderPrepareMirror(globalposx, globalposy, qglobalang, mirrorlist[i].wallnum, &gx, &gy, &viewangle); gx = globalposx; @@ -2120,7 +2120,7 @@ static void polymer_displayrooms(const int16_t dacursectnum) display_mirror = 0; glDisable(GL_CULL_FACE); - drawmasks(); + renderDrawMasks(); glEnable(GL_CULL_FACE); } return; diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 512463cdf..ff8cda078 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -7321,7 +7321,7 @@ void polymost_fillpolygon(int32_t npoints) ((float *)ry1)[i] = ((float)ry1[i])*(1.0f/4096.f); } - if (gloy1 != -1) setpolymost2dview(); //disables blending, texturing, and depth testing + if (gloy1 != -1) polymostSet2dView(); //disables blending, texturing, and depth testing glEnable(GL_ALPHA_TEST); glEnable(GL_TEXTURE_2D); pthtyp *pth = our_texcache_fetch(DAMETH_NOMASK | (videoGetRenderMode() == REND_POLYMOST && r_useindexedcolortextures ? PTH_INDEXED : 0)); @@ -7537,7 +7537,7 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba polymost_usePaletteIndexing(false); - setpolymost2dview(); // disables blending, texturing, and depth testing + polymostSet2dView(); // disables blending, texturing, and depth testing glDisable(GL_ALPHA_TEST); glDepthMask(GL_FALSE); // disable writing to the z-buffer diff --git a/source/build/src/screenshot.cpp b/source/build/src/screenshot.cpp index 13cb9ff20..9e77e737b 100644 --- a/source/build/src/screenshot.cpp +++ b/source/build/src/screenshot.cpp @@ -52,7 +52,7 @@ static void screencapture_end(char *fn, BFILE** filptr) # define HICOLOR 0 # endif -int screencapture(const char *filename, char inverseit) +int videoCaptureScreen(const char *filename, char inverseit) { char *fn = Xstrdup(filename); FILE *fp = capturecounter.opennextfile_withext(fn, "png"); @@ -129,7 +129,7 @@ int screencapture(const char *filename, char inverseit) return 0; } -int screencapture_tga(const char *filename, char inverseit) +int videoCaptureScreenTGA(const char *filename, char inverseit) { int32_t i; char head[18] = { 0,1,1,0,0,0,1,24,0,0,0,0,0/*wlo*/,0/*whi*/,0/*hlo*/,0/*hhi*/,8,0 }; diff --git a/source/build/src/tiles.cpp b/source/build/src/tiles.cpp index aec3f09fb..c7e7260f6 100644 --- a/source/build/src/tiles.cpp +++ b/source/build/src/tiles.cpp @@ -635,7 +635,7 @@ void tileLoadData(int16_t tilenume, int32_t dasiz, char *buffer) if (artfil == -1) { initprintf("Failed opening ART file \"%s\"!\n", fn); - uninitengine(); + engineUnInit(); Bexit(11); } diff --git a/source/duke3d/src/anim.cpp b/source/duke3d/src/anim.cpp index 955fbc62d..7cd84254b 100644 --- a/source/duke3d/src/anim.cpp +++ b/source/duke3d/src/anim.cpp @@ -497,7 +497,7 @@ int32_t Anim_Play(const char *fn) i = VM_OnEventWithReturn(EVENT_PRECUTSCENE, g_player[screenpeek].ps->i, screenpeek, i); waloff[TILE_ANIM] = (intptr_t)ANIM_DrawFrame(i); - invalidatetile(TILE_ANIM, 0, 1 << 4); // JBF 20031228 + tileInvalidate(TILE_ANIM, 0, 1 << 4); // JBF 20031228 if (VM_OnEventWithReturn(EVENT_SKIPCUTSCENE, g_player[screenpeek].ps->i, screenpeek, I_CheckAllInput())) { @@ -524,9 +524,9 @@ int32_t Anim_Play(const char *fn) else z = divscale16(lrint(320 * ydim * anim->frameaspect1), lrint(tilesiz[TILE_ANIM].y * xdim * anim->frameaspect2)); int32_t aspect = divscale16(lrint(tilesiz[TILE_ANIM].y * anim->frameaspect2), lrint(tilesiz[TILE_ANIM].x * anim->frameaspect1)); - videoSetAspect(viewingrange, aspect); + renderSetAspect(viewingrange, aspect); rotatesprite_fs(160<<16, 100<<16, z, 512, TILE_ANIM, 0, 0, 2|4|8|64|1024); - videoSetAspect(viewingrange, oyxaspect); + renderSetAspect(viewingrange, oyxaspect); } else { diff --git a/source/duke3d/src/astub.cpp b/source/duke3d/src/astub.cpp index ba3120604..f573bcafc 100644 --- a/source/duke3d/src/astub.cpp +++ b/source/duke3d/src/astub.cpp @@ -2228,7 +2228,7 @@ static void ExtSE40Draw(int32_t spnum,int32_t x,int32_t y,int32_t z,int16_t a,in drawrooms(x+offx,y+offy,z+offz,a,h,sprite[floor2].sectnum); ExtAnalyzeSprites(0,0,0,0); - drawmasks(); + renderDrawMasks(); M32_ResetFakeRORTiles(); if (draw_both) @@ -2254,7 +2254,7 @@ static void ExtSE40Draw(int32_t spnum,int32_t x,int32_t y,int32_t z,int16_t a,in // Now re-draw drawrooms(x+offx,y+offy,z+offz,a,h,sprite[floor2].sectnum); ExtAnalyzeSprites(0,0,0,0); - drawmasks(); + renderDrawMasks(); M32_ResetFakeRORTiles(); } @@ -2703,7 +2703,7 @@ static int32_t m32gettile(int32_t idInitialTile) if (handleevents()) quitevent = 0; } - getmousevalues(&mousedx,&mousedy,&bstatus); + mouseGetValues(&mousedx,&mousedy,&bstatus); iLastTile = tileNum; @@ -3271,7 +3271,7 @@ static int32_t OnSelectTile(int32_t tileNum) keyFlushChars(); - setpolymost2dview(); + polymostSet2dView(); #ifdef USE_OPENGL if (videoGetRenderMode() >= REND_POLYMOST) { @@ -3409,7 +3409,7 @@ static void tilescreen_drawbox(int32_t iTopLeft, int32_t iSelected, int32_t nXTi char markedcol = editorcolors[14]; - setpolymost2dview(); + polymostSet2dView(); y1=max(y1, 0); y2=min(y2, ydim-1); @@ -3505,7 +3505,7 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i static uint8_t loadedhitile[(MAXTILES+7)>>3]; #ifdef USE_OPENGL - setpolymost2dview(); + polymostSet2dView(); if (videoGetRenderMode() >= REND_POLYMOST) { @@ -3670,10 +3670,10 @@ static void drawtileinfo(const char *title,int32_t x,int32_t y,int32_t picnum,in const int32_t scale = (int32_t)(65536.0/scalediv); const int32_t oviewingrange=viewingrange, oyxaspect=yxaspect; - videoSetAspect(65536, divscale16(ydim*320, xdim*200)); + renderSetAspect(65536, divscale16(ydim*320, xdim*200)); // +1024: prevents rotatesprite from setting aspect itself rotatesprite_fs((x1+13)<<16,(y+11)<<16,scale,0, picnum,shade,pal, 2+1024); - videoSetAspect(oviewingrange, oyxaspect); + renderSetAspect(oviewingrange, oyxaspect); } x = (int32_t)(x * xdimgame/320.0); @@ -8481,7 +8481,7 @@ static int32_t osdcmd_quit(osdfuncparm_t const * const UNUSED(parm)) OSD_ShowDisplay(0); ExtUnInit(); - uninitengine(); + engineUnInit(); Bfflush(NULL); @@ -10031,7 +10031,7 @@ int32_t ExtPostStartupWindow(void) if (!g_useCwd) G_CleanupSearchPaths(); - if (initengine()) + if (engineInit()) { initprintf("There was a problem initializing the engine.\n"); return -1; @@ -10393,7 +10393,7 @@ void ExtPreCheckKeys(void) // just before drawrooms if (m32_sideview) { - screencoords(&xp1, &yp1, sprite[i].x-pos.x, sprite[i].y-pos.y, zoom); + editorGet2dScreenCoordinates(&xp1, &yp1, sprite[i].x-pos.x, sprite[i].y-pos.y, zoom); yp1 += midydim16 + getscreenvdisp(sprite[i].z-pos.z, zoom); yp1 -= mulscale14(tilesiz[picnum].y<<2, zoom); xp1 += halfxdim16; @@ -10409,10 +10409,10 @@ void ExtPreCheckKeys(void) // just before drawrooms continue; const int32_t oviewingrange=viewingrange, oyxaspect=yxaspect; - videoSetAspect(yxaspect, divscale16(sprite[i].yrepeat, sprite[i].xrepeat)); + renderSetAspect(yxaspect, divscale16(sprite[i].yrepeat, sprite[i].xrepeat)); rotatesprite(xp1<<16,yp1<<16,zoom<<5,daang,picnum, shade,sprite[i].pal,flags|1024,0,0,xdim-1,ydim16-1); - videoSetAspect(oviewingrange, oyxaspect); + renderSetAspect(oviewingrange, oyxaspect); } } @@ -10430,7 +10430,7 @@ void ExtPreCheckKeys(void) // just before drawrooms if (showambiencesounds==1 && sprite[i].sectnum!=cursectnum) continue; - screencoords(&xp1,&yp1, sprite[i].x-pos.x,sprite[i].y-pos.y, zoom); + editorGet2dScreenCoordinates(&xp1,&yp1, sprite[i].x-pos.x,sprite[i].y-pos.y, zoom); if (m32_sideview) yp1 += getscreenvdisp(sprite[i].z-pos.z, zoom); @@ -10444,7 +10444,7 @@ void ExtPreCheckKeys(void) // just before drawrooms } else radius = mulscale14(sprite[i].hitag, zoom); - drawcircle16(halfxdim16+xp1, midydim16+yp1, radius, scalescreeny(16384), col); + editorDraw2dCircle(halfxdim16+xp1, midydim16+yp1, radius, scalescreeny(16384), col); drawlinepat = 0xffffffff; } } @@ -10941,7 +10941,7 @@ void ExtCheckKeys(void) extern int32_t engine_screenshot; engine_screenshot = 1; #else - screencapture("captxxxx.tga", eitherSHIFT); + videoCaptureScreen("captxxxx.tga", eitherSHIFT); silentmessage("Saved screenshot"); #endif } diff --git a/source/duke3d/src/common.cpp b/source/duke3d/src/common.cpp index 1947051fe..16fa613c0 100644 --- a/source/duke3d/src/common.cpp +++ b/source/duke3d/src/common.cpp @@ -163,19 +163,19 @@ void G_InitMultiPsky(int CLOUDYOCEAN__DYN, int MOONSKY1__DYN, int BIGORBIT1__DYN // set as tight as possible.) // The default sky properties (all others are implicitly zero): - psky_t *sky = E_DefinePsky(DEFAULTPSKY); + psky_t *sky = tileSetupSky(DEFAULTPSKY); sky->lognumtiles = 3; sky->horizfrac = 32768; // CLOUDYOCEAN // Aligns with the drawn scene horizon because it has one itself. - sky = E_DefinePsky(CLOUDYOCEAN__DYN); + sky = tileSetupSky(CLOUDYOCEAN__DYN); sky->lognumtiles = 3; sky->horizfrac = 65536; // MOONSKY1 // earth mountain mountain sun - sky = E_DefinePsky(MOONSKY1__DYN); + sky = tileSetupSky(MOONSKY1__DYN); sky->lognumtiles = 3; sky->horizfrac = 32768; sky->tileofs[6] = 1; @@ -185,7 +185,7 @@ void G_InitMultiPsky(int CLOUDYOCEAN__DYN, int MOONSKY1__DYN, int BIGORBIT1__DYN // BIGORBIT1 // orbit // earth1 2 3 moon/sun - sky = E_DefinePsky(BIGORBIT1__DYN); + sky = tileSetupSky(BIGORBIT1__DYN); sky->lognumtiles = 3; sky->horizfrac = 32768; sky->tileofs[5] = 1; @@ -195,7 +195,7 @@ void G_InitMultiPsky(int CLOUDYOCEAN__DYN, int MOONSKY1__DYN, int BIGORBIT1__DYN // LA // la city // earth1 2 3 moon/sun - sky = E_DefinePsky(LA__DYN); + sky = tileSetupSky(LA__DYN); sky->lognumtiles = 3; sky->horizfrac = 16384 + 1024; sky->tileofs[0] = 1; diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index d3a8ed84c..16fe874f1 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -203,7 +203,7 @@ void G_HandleSpecialKeys(void) if (KB_UnBoundKeyPressed(sc_F12)) { KB_ClearKeyDown(sc_F12); - screencapture( + videoCaptureScreen( #ifndef EDUKE32_STANDALONE "duke0000.tga" #else @@ -319,7 +319,7 @@ int32_t m32_numdebuglines=0; static void M32_drawdebug(void) { - int i, col=getclosestcol(255,255,255); + int i, col=paletteGetClosestColor(255,255,255); int x=4, y=8; if (m32_numdebuglines>0) @@ -521,7 +521,7 @@ static void G_SE40(int32_t smoothratio) if (videoGetRenderMode() == REND_POLYMER) polymer_setanimatesprites(G_DoSpriteAnimations, CAMERA(pos.x), CAMERA(pos.y), fix16_to_int(CAMERA(q16ang)), smoothratio); #endif - drawrooms_q16(sprite[sprite2].x + x, sprite[sprite2].y + y, + renderDrawRoomsQ16(sprite[sprite2].x + x, sprite[sprite2].y + y, z + renderz, CAMERA(q16ang), CAMERA(q16horiz), sect); drawing_ror = 1 + level; @@ -529,7 +529,7 @@ static void G_SE40(int32_t smoothratio) G_OROR_DupeSprites(sp); G_DoSpriteAnimations(CAMERA(pos.x),CAMERA(pos.y),fix16_to_int(CAMERA(q16ang)),smoothratio); - drawmasks(); + renderDrawMasks(); if (level) { @@ -606,7 +606,7 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, fix16_t a, fix16_t q16horiz int32_t tposx, tposy; fix16_t tang; - preparemirror(x, y, a, g_mirrorWall[i], &tposx, &tposy, &tang); + renderPrepareMirror(x, y, a, g_mirrorWall[i], &tposx, &tposy, &tang); int32_t j = g_visibility; g_visibility = (j>>1) + (j>>2); @@ -616,20 +616,20 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, fix16_t a, fix16_t q16horiz int32_t didmirror; yax_preparedrawrooms(); - didmirror = drawrooms_q16(tposx,tposy,z,tang,q16horiz,g_mirrorSector[i]+MAXSECTORS); + didmirror = renderDrawRoomsQ16(tposx,tposy,z,tang,q16horiz,g_mirrorSector[i]+MAXSECTORS); yax_drawrooms(G_DoSpriteAnimations, g_mirrorSector[i], didmirror, smoothratio); } #ifdef USE_OPENGL else - drawrooms_q16(tposx,tposy,z,tang,q16horiz,g_mirrorSector[i]+MAXSECTORS); + renderDrawRoomsQ16(tposx,tposy,z,tang,q16horiz,g_mirrorSector[i]+MAXSECTORS); // XXX: Sprites don't get drawn with TROR/Polymost #endif display_mirror = 1; G_DoSpriteAnimations(tposx,tposy,fix16_to_int(tang),smoothratio); display_mirror = 0; - drawmasks(); - completemirror(); //Reverse screen x-wise in this function + renderDrawMasks(); + renderCompleteMirror(); //Reverse screen x-wise in this function g_visibility = j; } @@ -680,7 +680,7 @@ static void G_ReadGLFrame(void) for (x = 0; x < 320; x++) { const palette_t *pix = &frame[base + mulscale16(x, xf) + (xdim-(ydim*4/3))/2]; - pic[320 * y + x] = getclosestcol(pix->r, pix->g, pix->b); + pic[320 * y + x] = paletteGetClosestColor(pix->r, pix->g, pix->b); } } @@ -759,10 +759,10 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) polymer_setanimatesprites(G_DoSpriteAnimations, pSprite->x, pSprite->y, fix16_to_int(CAMERA(q16ang)), smoothRatio); #endif yax_preparedrawrooms(); - drawrooms_q16(pSprite->x, pSprite->y, pSprite->z - ZOFFSET6, CAMERA(q16ang), fix16_from_int(pSprite->yvel), pSprite->sectnum); + renderDrawRoomsQ16(pSprite->x, pSprite->y, pSprite->z - ZOFFSET6, CAMERA(q16ang), fix16_from_int(pSprite->yvel), pSprite->sectnum); yax_drawrooms(G_DoSpriteAnimations, pSprite->sectnum, 0, smoothRatio); G_DoSpriteAnimations(pSprite->x, pSprite->y, fix16_to_int(CAMERA(q16ang)), smoothRatio); - drawmasks(); + renderDrawMasks(); } } else @@ -779,13 +779,13 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) ))); if (!r_usenewaspect) - videoSetAspect(vr, yxaspect); + renderSetAspect(vr, yxaspect); else { viewingRange = vr; yxAspect = tabledivide32_noinline(65536 * ydim * 8, xdim * 5); - videoSetAspect(mulscale16(viewingRange,viewingrange), yxaspect); + renderSetAspect(mulscale16(viewingRange,viewingrange), yxaspect); } if (g_screenCapture) @@ -795,7 +795,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) cacheAllocateBlock(&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]); if (videoGetRenderMode() == REND_CLASSIC) - videoSetTarget(TILE_SAVESHOT, 200, 320); + renderSetTarget(TILE_SAVESHOT, 200, 320); } else if (screenTilting) { @@ -854,7 +854,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) if (waloff[TILE_TILT] == 0) cacheAllocateBlock(&waloff[TILE_TILT], maxTiltSize, &walock[TILE_TILT]); - videoSetTarget(TILE_TILT, viewtilexsiz, viewtileysiz); + renderSetTarget(TILE_TILT, viewtilexsiz, viewtileysiz); if ((tang&1023) == 512) { @@ -877,7 +877,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) vRange = sintable[vRange + 512] * 8 + sintable[vRange] * 5; // setaspect(i>>1, yxaspect); - videoSetAspect(mulscale16(oviewingrange, vRange >> 1), yxaspect); + renderSetAspect(mulscale16(oviewingrange, vRange >> 1), yxaspect); viewingRange = vRange >> 1; yxAspect = tabledivide32_noinline(65536 * ydim * 8, xdim * 5); @@ -890,7 +890,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) )) { #ifdef USE_OPENGL - setrollangle(pPlayer->orotscrnang + mulscale16(((pPlayer->rotscrnang - pPlayer->orotscrnang + 1024)&2047)-1024, smoothRatio)); + renderSetRollAngle(pPlayer->orotscrnang + mulscale16(((pPlayer->rotscrnang - pPlayer->orotscrnang + 1024)&2047)-1024, smoothRatio)); #endif pPlayer->orotscrnang = pPlayer->rotscrnang; } @@ -1031,7 +1031,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) gotpic[MIRROR>>3] |= (1<<(MIRROR&7)); #else yax_preparedrawrooms(); - drawrooms_q16(CAMERA(pos.x),CAMERA(pos.y),CAMERA(pos.z),CAMERA(q16ang),CAMERA(q16horiz),CAMERA(sect)); + renderDrawRoomsQ16(CAMERA(pos.x),CAMERA(pos.y),CAMERA(pos.z),CAMERA(q16ang),CAMERA(q16horiz),CAMERA(sect)); yax_drawrooms(G_DoSpriteAnimations, CAMERA(sect), 0, smoothRatio); #ifdef LEGACY_ROR if ((unsigned)ror_sprite < MAXSPRITES && drawing_ror == 1) // viewing from bottom @@ -1041,7 +1041,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) #ifdef LEGACY_ROR drawing_ror = 0; #endif - drawmasks(); + renderDrawMasks(); #endif } @@ -1049,11 +1049,11 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) { g_screenCapture = 0; - invalidatetile(TILE_SAVESHOT, 0, 255); + tileInvalidate(TILE_SAVESHOT, 0, 255); if (videoGetRenderMode() == REND_CLASSIC) { - videoRestoreTarget(); + renderRestoreTarget(); // walock[TILE_SAVESHOT] = 1; } #ifdef USE_OPENGL @@ -1090,7 +1090,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) } else { - videoRestoreTarget(); + renderRestoreTarget(); picanm[TILE_TILT].xofs = picanm[TILE_TILT].yofs = 0; int tiltZoom = (tang&511); @@ -1173,7 +1173,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio) if (r_usenewaspect) { newaspect_enable = 0; - videoSetAspect(viewingRange, yxAspect); + renderSetAspect(viewingRange, yxAspect); } VM_OnEvent(EVENT_DISPLAYROOMSEND, g_player[screenpeek].ps->i, screenpeek); @@ -5621,7 +5621,7 @@ void G_Shutdown(void) S_MusicShutdown(); CONTROL_Shutdown(); KB_Shutdown(); - uninitengine(); + engineUnInit(); G_Cleanup(); FreeGroups(); OSD_Cleanup(); @@ -5845,7 +5845,7 @@ static void G_Startup(void) G_CompileScripts(); - if (initengine()) + if (engineInit()) G_FatalEngineError(); #ifdef LUNATIC @@ -6332,7 +6332,7 @@ int app_main(int argc, char const * const * argv) } #endif - if (preinitengine()) + if (enginePreInit()) { wm_msgbox("Build Engine Initialization Error", "There was a problem initializing the Build engine: %s", engineerrstr); @@ -6350,7 +6350,7 @@ int app_main(int argc, char const * const * argv) { if (quitevent || !startwin_run()) { - uninitengine(); + engineUnInit(); Bexit(0); } } @@ -6454,7 +6454,7 @@ int app_main(int argc, char const * const * argv) free(m); g_defModules.clear(); - if (E_PostInit()) + if (enginePostInit()) G_FatalEngineError(); G_PostLoadPalette(); @@ -6503,7 +6503,7 @@ int app_main(int argc, char const * const * argv) if (CONTROL_Startup(controltype_keyboardandmouse, &BGetTime, TICRATE)) { ERRprintf("There was an error initializing the CONTROL system.\n"); - uninitengine(); + engineUnInit(); Bexit(5); } @@ -6520,7 +6520,7 @@ int app_main(int argc, char const * const * argv) } #ifdef HAVE_CLIPSHAPE_FEATURE - int const clipMapError = clipmapinfo_load(); + int const clipMapError = engineLoadClipMaps(); if (clipMapError > 0) initprintf("There was an error loading the sprite clipping map (status %d).\n", clipMapError); diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index f05aa6514..493fb505b 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -1244,13 +1244,13 @@ LUNATIC_EXTERN void G_ShowView(vec3_t vec, fix16_t a, fix16_t horiz, int32_t sec polymer_setanimatesprites(G_DoSpriteAnimations, vec.x, vec.y, fix16_to_int(a), smoothratio); #endif yax_preparedrawrooms(); - drawrooms_q16(vec.x, vec.y, vec.z, a, horiz, sect); + renderDrawRoomsQ16(vec.x, vec.y, vec.z, a, horiz, sect); yax_drawrooms(G_DoSpriteAnimations, sect, 0, smoothratio); display_mirror = 2; G_DoSpriteAnimations(vec.x, vec.y, fix16_to_int(a), smoothratio); display_mirror = 0; - drawmasks(); + renderDrawMasks(); G_RestoreInterpolations(); G_UpdateScreenArea(); } @@ -1975,7 +1975,7 @@ skip_check: insptr++; { int const xRange = Gv_GetVarX(*insptr++); - videoSetAspect(xRange, Gv_GetVarX(*insptr++)); + renderSetAspect(xRange, Gv_GetVarX(*insptr++)); break; } diff --git a/source/duke3d/src/m32exec.cpp b/source/duke3d/src/m32exec.cpp index 8bc3c21d7..080d746ac 100644 --- a/source/duke3d/src/m32exec.cpp +++ b/source/duke3d/src/m32exec.cpp @@ -2277,7 +2277,7 @@ badindex: insptr++; { int32_t r = Gv_GetVarX(*insptr++), g = Gv_GetVarX(*insptr++), b = Gv_GetVarX(*insptr++); - Gv_SetVarX(*insptr++, getclosestcol(r, g, b)); + Gv_SetVarX(*insptr++, paletteGetClosestColor(r, g, b)); continue; } @@ -2899,7 +2899,7 @@ dodefault: if (daxrange > (1<<20)) daxrange = (1<<20); if (dayxaspect < (1<<12)) dayxaspect = (1<<12); if (dayxaspect > (1<<20)) dayxaspect = (1<<20); - videoSetAspect(daxrange, dayxaspect); + renderSetAspect(daxrange, dayxaspect); continue; } @@ -3021,8 +3021,8 @@ dodefault: if (tw==CON_DRAWLINE16B || tw==CON_DRAWLINE16Z) { - screencoords(&x1,&y1, x1-pos.x,y1-pos.y, zoom); - screencoords(&x2,&y2, x2-pos.x,y2-pos.y, zoom); + editorGet2dScreenCoordinates(&x1,&y1, x1-pos.x,y1-pos.y, zoom); + editorGet2dScreenCoordinates(&x2,&y2, x2-pos.x,y2-pos.y, zoom); if (tw==CON_DRAWLINE16Z && m32_sideview) { @@ -3035,7 +3035,7 @@ dodefault: } drawlinepat = m32_drawlinepat; - drawline16(xofs+x1,yofs+y1, xofs+x2,yofs+y2, col>=0?editorcolors[col&15]:((-col)&255)); + editorDraw2dLine(xofs+x1,yofs+y1, xofs+x2,yofs+y2, col>=0?editorcolors[col&15]:((-col)&255)); drawlinepat = odrawlinepat; continue; } @@ -3053,7 +3053,7 @@ dodefault: if (tw==CON_DRAWCIRCLE16B || tw==CON_DRAWCIRCLE16Z) { - screencoords(&x1,&y1, x1-pos.x,y1-pos.y, zoom); + editorGet2dScreenCoordinates(&x1,&y1, x1-pos.x,y1-pos.y, zoom); if (m32_sideview) y1 += getscreenvdisp(z1-pos.z, zoom); r = mulscale14(r,zoom); @@ -3063,7 +3063,7 @@ dodefault: } drawlinepat = m32_drawlinepat; - drawcircle16(xofs+x1, yofs+y1, r, eccen, col>=0?editorcolors[col&15]:((-col)&255)); + editorDraw2dCircle(xofs+x1, yofs+y1, r, eccen, col>=0?editorcolors[col&15]:((-col)&255)); drawlinepat = odrawlinepat; continue; } diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index dc7dc71ec..1808c1c46 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -3045,7 +3045,7 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry) { if (videoSetGameMode(p.flags, p.xdim, p.ydim, p.bppmax) < 0) { - setrendermode(prend); + videoSetRenderMode(prend); G_GameExit("Failed restoring old video mode."); } else @@ -3058,7 +3058,7 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry) g_restorePalette = -1; G_UpdateScreenArea(); - setrendermode(nrend); + videoSetRenderMode(nrend); vsync = videoSetVsync(nvsync); ud.config.ScreenMode = fullscreen; ud.config.ScreenWidth = xdim; @@ -6964,7 +6964,7 @@ void M_DisplayMenus(void) int32_t alpha; if (KXDWN) { - videoSetAspect(viewingrange, 65536); + renderSetAspect(viewingrange, 65536); cursorpos.x = scale(cursorpos.x - (320<<15), ydim << 2, xdim * 3) + (320<<15); cursorpos.y = scale(cursorpos.y - (200<<15), (ydim << 2) * 6, (xdim * 3) * 5) + (200<<15); z = scale(32768, ydim << 2, xdim * 3); @@ -6980,7 +6980,7 @@ void M_DisplayMenus(void) rotatesprite_fs_alpha(cursorpos.x, cursorpos.y, z, 0, a, 0, p, o, alpha); if (KXDWN) - videoSetAspect(viewingrange, oyxaspect); + renderSetAspect(viewingrange, oyxaspect); } } else diff --git a/source/duke3d/src/osdcmds.cpp b/source/duke3d/src/osdcmds.cpp index ae2c87319..5f23cb676 100644 --- a/source/duke3d/src/osdcmds.cpp +++ b/source/duke3d/src/osdcmds.cpp @@ -1229,8 +1229,8 @@ static int32_t osdcmd_screenshot(osdfuncparm_t const * const parm) #endif if (parm->numparms == 1 && !Bstrcasecmp(parm->parms[0], "tga")) - screencapture_tga(fn, 0); - else screencapture(fn, 0); + videoCaptureScreenTGA(fn, 0); + else videoCaptureScreen(fn, 0); return OSDCMD_OK; } diff --git a/source/duke3d/src/osdfuncs.cpp b/source/duke3d/src/osdfuncs.cpp index 57190922b..b7c54701b 100644 --- a/source/duke3d/src/osdfuncs.cpp +++ b/source/duke3d/src/osdfuncs.cpp @@ -149,7 +149,7 @@ void GAME_clearbackground(int32_t numcols, int32_t numrows) polymost_setFogEnabled(false); polymost_useColorOnly(true); - setpolymost2dview(); + polymostSet2dView(); glColor4f(0.f, 0.f, 0.f, 0.67f); glEnable(GL_BLEND); glRecti(0, 0, xdim, i8n8+OSDCHAR_HEIGHT); diff --git a/source/duke3d/src/premap.cpp b/source/duke3d/src/premap.cpp index 1ec4dd9ed..50bbaec58 100644 --- a/source/duke3d/src/premap.cpp +++ b/source/duke3d/src/premap.cpp @@ -1676,7 +1676,7 @@ static void G_FadeLoad(int32_t r, int32_t g, int32_t b, int32_t start, int32_t e static int G_TryMapHack(const char *mhkfile) { - int32_t failure = loadmaphack(mhkfile); + int32_t failure = engineLoadMHK(mhkfile); if (!failure) initprintf("Loaded map hack file \"%s\"\n", mhkfile); @@ -1852,7 +1852,7 @@ int G_EnterLevel(int gameMode) if (!VOLUMEONE && Menu_HaveUserMap()) { - if (loadboard(boardfilename, 0, &pPlayer->pos, &lbang, &pPlayer->cursectnum) < 0) + if (engineLoadBoard(boardfilename, 0, &pPlayer->pos, &lbang, &pPlayer->cursectnum) < 0) { OSD_Printf(OSD_ERROR "Map \"%s\" not found or invalid map version!\n", boardfilename); return 1; @@ -1861,7 +1861,7 @@ int G_EnterLevel(int gameMode) G_LoadMapHack(levelName, boardfilename); G_SetupFilenameBasedMusic(levelName, boardfilename, ud.m_level_number); } - else if (loadboard(g_mapInfo[mii].filename, VOLUMEONE, &pPlayer->pos, &lbang, &pPlayer->cursectnum) < 0) + else if (engineLoadBoard(g_mapInfo[mii].filename, VOLUMEONE, &pPlayer->pos, &lbang, &pPlayer->cursectnum) < 0) { OSD_Printf(OSD_ERROR "Map \"%s\" not found or invalid map version!\n", g_mapInfo[mii].filename); return 1; diff --git a/source/duke3d/src/savegame.cpp b/source/duke3d/src/savegame.cpp index 28100cdba..6d3861549 100644 --- a/source/duke3d/src/savegame.cpp +++ b/source/duke3d/src/savegame.cpp @@ -309,7 +309,7 @@ int32_t G_LoadSaveHeaderNew(char const *fn, savehead_t *saveh) { Bmemset((char *)waloff[TILE_LOADSHOT], 0, 320*200); } - invalidatetile(TILE_LOADSHOT, 0, 255); + tileInvalidate(TILE_LOADSHOT, 0, 255); kclose(fil); return 0; @@ -392,7 +392,7 @@ int32_t G_LoadPlayer(savebrief_t & sv) { artSetupMapArt(currentboardfilename); append_ext_UNSAFE(currentboardfilename, ".mhk"); - loadmaphack(currentboardfilename); + engineLoadMHK(currentboardfilename); } Bmemcpy(currentboardfilename, boardfilename, BMAX_PATH); diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index 094d725e7..f13605b40 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -158,8 +158,8 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b) if (ii <= 0) return; if (videoGetRenderMode() == REND_CLASSIC) - i = getclosestcol(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b); - else i = getclosestcol(255, 255, 255); // use white in GL so we can tint it to the right color + i = paletteGetClosestColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b); + else i = paletteGetClosestColor(255, 255, 255); // use white in GL so we can tint it to the right color do { @@ -178,7 +178,7 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b) crosshairtint.b = CrosshairColors.b; crosshairtint.f = HICTINT_USEONART | HICTINT_GRAYSCALE; #endif - invalidatetile(CROSSHAIR, -1, -1); + tileInvalidate(CROSSHAIR, -1, -1); } #define SCORESHEETOFFSET -20 @@ -329,7 +329,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 int32_t tmpydim = (xdim*5)/8; - videoSetAspect(65536, divscale16(tmpydim*320, xdim*200)); + renderSetAspect(65536, divscale16(tmpydim*320, xdim*200)); xvect = sintable[(-cang)&2047] * czoom; yvect = sintable[(1536-cang)&2047] * czoom; @@ -1068,7 +1068,7 @@ void G_DisplayRest(int32_t smoothratio) if (ud.overhead_on == 2) { videoClearViewableArea(0L); - drawmapview(cposx, cposy, pp->zoom, cang); + renderDrawMapView(cposx, cposy, pp->zoom, cang); } G_DrawOverheadMap(cposx, cposy, pp->zoom, cang); @@ -1173,13 +1173,13 @@ void G_DisplayRest(int32_t smoothratio) crosshair_scale = scale(crosshair_scale, ydim << 2, xdim * 3) >> 1; crosshair_pal = 0; crosshair_o |= 1024; - videoSetAspect(viewingrange, 65536); + renderSetAspect(viewingrange, 65536); } rotatesprite_win(crosshairpos.x, crosshairpos.y, crosshair_scale, 0, a, 0, crosshair_pal, crosshair_o); if (KXDWN) - videoSetAspect(viewingrange, oyxaspect); + renderSetAspect(viewingrange, oyxaspect); } } @@ -1204,13 +1204,13 @@ void G_DisplayRest(int32_t smoothratio) pointer_scale = scale(pointer_scale, ydim << 2, xdim * 3) >> 1; pointer_pal = 0; pointer_o |= 1024; - videoSetAspect(viewingrange, 65536); + renderSetAspect(viewingrange, 65536); } rotatesprite_win(pointerpos.x, pointerpos.y, pointer_scale, 0, a, 0, pointer_pal, pointer_o); if (KXDWN) - videoSetAspect(viewingrange, oyxaspect); + renderSetAspect(viewingrange, oyxaspect); } } #endif @@ -1233,7 +1233,7 @@ void G_DisplayRest(int32_t smoothratio) { int32_t vr=viewingrange, asp=yxaspect; VM_OnEvent_(EVENT_DISPLAYREST, g_player[screenpeek].ps->i, screenpeek); - videoSetAspect(vr, asp); + renderSetAspect(vr, asp); } if (ud.pause_on==1 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index 6bbfce2cd..d647a7fd6 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -380,7 +380,7 @@ static void G_SetupCamTile(int spriteNum, int tileNum, int smoothRatio) int const saveMirror = display_mirror; //if (waloff[wn] == 0) loadtile(wn); - videoSetTarget(tileNum, tilesiz[tileNum].y, tilesiz[tileNum].x); + renderSetTarget(tileNum, tilesiz[tileNum].y, tilesiz[tileNum].x); yax_preparedrawrooms(); drawrooms(camera.x, camera.y, camera.z, SA(spriteNum), 100 + sprite[spriteNum].shade, SECT(spriteNum)); @@ -389,11 +389,11 @@ static void G_SetupCamTile(int spriteNum, int tileNum, int smoothRatio) display_mirror = 3; G_DoSpriteAnimations(camera.x, camera.y, SA(spriteNum), smoothRatio); display_mirror = saveMirror; - drawmasks(); + renderDrawMasks(); - videoRestoreTarget(); + renderRestoreTarget(); squarerotatetile(tileNum); - invalidatetile(tileNum, -1, 255); + tileInvalidate(tileNum, -1, 255); } void G_AnimateCamSprite(int smoothRatio)