Function names

git-svn-id: https://svn.eduke32.com/eduke32@6831 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-04-12 21:03:47 +00:00
parent e5bcc1cf81
commit 19c43b84b3
31 changed files with 375 additions and 394 deletions

View file

@ -772,7 +772,7 @@ static FORCE_INLINE int32_t getpskyidx(int32_t picnum)
return j; return j;
} }
EXTERN psky_t * E_DefinePsky(int32_t tilenum); EXTERN psky_t * tileSetupSky(int32_t tilenum);
EXTERN char parallaxtype; EXTERN char parallaxtype;
EXTERN int32_t parallaxyoffs_override, parallaxyscale_override; EXTERN int32_t parallaxyoffs_override, parallaxyscale_override;
@ -1017,37 +1017,37 @@ typedef struct artheader_t {
} artheader_t; } artheader_t;
#define ARTv1_UNITOFFSET ((signed)(4*sizeof(int32_t) + 2*sizeof(int16_t) + sizeof(picanm_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 enginePreInit(void); // a partial setup of the engine used for launch windows
int32_t initengine(void); int32_t engineInit(void);
int32_t E_PostInit(void); int32_t enginePostInit(void);
void uninitengine(void); void engineUnInit(void);
void initspritelists(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 engineLoadBoard(const char *filename, char flags, vec3_t *dapos, int16_t *daang, int16_t *dacursectnum);
int32_t loadmaphack(const char *filename); int32_t engineLoadMHK(const char *filename);
void delete_maphack_lights(); void engineClearLightsFromMHK();
#ifdef HAVE_CLIPSHAPE_FEATURE #ifdef HAVE_CLIPSHAPE_FEATURE
int32_t clipmapinfo_load(void); int32_t engineLoadClipMaps(void);
#endif #endif
int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int16_t dacursectnum); int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int16_t dacursectnum);
void tileSetupDummy(int32_t const tile); void tileSetupDummy(int32_t const tile);
void tileSetData(int32_t const tile, int32_t tsiz, char const * const buffer); void tileSetData(int32_t const tile, int32_t tsiz, char const *const buffer);
void tileDelete(int32_t const tile); void tileDelete(int32_t const tile);
void tileSetSize(int32_t picnum, int16_t dasizx, int16_t dasizy); 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 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 artReadHeaderFromBuffer(uint8_t const *const buf, artheader_t *const local);
int32_t artCheckUnitFileHeader(uint8_t const * const buf, int32_t length); int32_t artCheckUnitFileHeader(uint8_t const *const buf, int32_t length);
void tileConvertAnimFormat(int32_t const picnum); void tileConvertAnimFormat(int32_t const picnum);
void artReadManifest(int32_t const fil, artheader_t const * const local); void artReadManifest(int32_t const fil, artheader_t const *const local);
void artPreloadFile(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); int32_t artLoadFiles(const char *filename, int32_t askedsize);
void artClearMapArt(void); void artClearMapArt(void);
void artSetupMapArt(const char *filename); void artSetupMapArt(const char *filename);
bool tileLoad(int16_t tilenume); bool tileLoad(int16_t tilenume);
void tileLoadData(int16_t tilenume, int32_t dasiz, char *buffer); 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 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); int32_t qloadkvx(int32_t voxindex, const char *filename);
void vox_undefine(int32_t const); 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 videoNextPage(void);
void videoSetCorrectedAspect(); void videoSetCorrectedAspect();
void videoSetViewableArea(int32_t x1, int32_t y1, int32_t x2, int32_t y2); 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 flushperms(void);
void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, int col) ATTRIBUTE((nonnull(1,2))); 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); void plotpixel(int32_t x, int32_t y, char col);
char getpixel(int32_t x, int32_t y); void renderSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz);
void videoSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz); void renderRestoreTarget(void);
void videoRestoreTarget(void); void renderPrepareMirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall,
void preparemirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall,
int32_t *tposx, int32_t *tposy, fix16_t *tang); 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) 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 videoClearViewableArea(int32_t dacol);
void videoClearScreen(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, 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, 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); 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; extern const int16_t *chsecptr_onextwall;
int32_t checksectorpointer(int16_t i, int16_t sectnum); 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 #if !KRANDDEBUG && !defined LUNATIC
static FORCE_INLINE int32_t krand(void) 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); return spriteheightofsptr((uspritetype *)&sprite[i], height, alsotileyofs);
} }
int screencapture(const char *filename, char inverseit) ATTRIBUTE((nonnull(1))); int videoCaptureScreen(const char *filename, char inverseit) ATTRIBUTE((nonnull(1)));
int screencapture_tga(const char *filename, char inverseit) ATTRIBUTE((nonnull(1))); int videoCaptureScreenTGA(const char *filename, char inverseit) ATTRIBUTE((nonnull(1)));
struct OutputFileCounter { struct OutputFileCounter {
uint16_t count = 0; uint16_t count = 0;
@ -1263,17 +1262,17 @@ int32_t wallvisible(int32_t x, int32_t y, int16_t wallnum);
//void qsetmode640480(void); //void qsetmode640480(void);
void videoSet2dMode(int32_t,int32_t); void videoSet2dMode(int32_t,int32_t);
void clear2dscreen(void); 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); 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))); 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); int32_t editorDraw2dLine(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); 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 #ifdef USE_OPENGL
void setrollangle(int32_t rolla); void renderSetRollAngle(int32_t rolla);
#endif #endif
// pal: pass -1 to invalidate all palettes for the tile, or >=0 for a particular palette // 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 6: 33% translucence, using clamping
// bit 7: 67% translucence, using clamping // bit 7: 67% translucence, using clamping
// clamping is for sprites, repeating is for walls // 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 polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, int32_t dimen, int32_t tilezoom,
int32_t usehitile, uint8_t *loadedhitile); 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 // if loadboard() fails with -2 return, try loadoldboard(). if it fails with
// -2, board is dodgy // -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 #ifdef __cplusplus
} }

View file

@ -55,12 +55,12 @@ typedef struct
extern mapinfo_t origmapinfo, clipmapinfo; extern mapinfo_t origmapinfo, clipmapinfo;
extern void clipmapinfo_init(); extern void engineInitClipMaps();
extern int32_t quickloadboard; extern int32_t quickloadboard;
extern int16_t *sectq; extern int16_t *sectq;
extern int16_t pictoidx[MAXTILES]; // maps tile num to clipinfo[] index extern int16_t pictoidx[MAXTILES]; // maps tile num to clipinfo[] index
extern int16_t clipspritelist[MAXCLIPNUM]; 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_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); extern int32_t clipsprite_initindex(int32_t curidx, uspritetype const * const curspr, int32_t *clipsectcnt, const vec3_t *vect);

View file

@ -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 int32_t getclosestcol_nocache_lim(int32_t r, int32_t g, int32_t b, int32_t lastokcol);
extern void getclosestcol_flush(void); 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); return getclosestcol_lim(r, g, b, 255);
} }

View file

@ -168,11 +168,11 @@ extern int32_t m32_wallscreenxy[MAXWALLS][2];
extern int16_t m32_wallsprite[MAXWALLS+MAXSPRITES]; extern int16_t m32_wallsprite[MAXWALLS+MAXSPRITES];
extern int8_t sideview_reversehrot; extern int8_t sideview_reversehrot;
extern int32_t scalescreeny(int32_t sy); 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 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 getinvdisplacement(int32_t *dx, int32_t *dy, int32_t dz) ATTRIBUTE((nonnull));
extern int32_t getscreenvdisp(int32_t bz, int32_t zoome); 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 int8_t keeptexturestretch;
extern int16_t pointhighlightdist, linehighlightdist; 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); 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 NEXTWALL(i) (wall[wall[i].nextwall])
#define POINT2(i) (wall[wall[i].point2]) #define POINT2(i) (wall[wall[i].point2])

View file

@ -94,7 +94,7 @@ void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, int co
videoBeginDrawing(); videoBeginDrawing();
for (i=0; i<numpoints-1; i++) for (i=0; i<numpoints-1; i++)
drawline16(xx[i], yy[i], xx[i+1], yy[i+1], col); editorDraw2dLine(xx[i], yy[i], xx[i+1], yy[i+1], col);
videoEndDrawing(); videoEndDrawing();
drawlinepat = odrawlinepat; drawlinepat = odrawlinepat;
@ -102,24 +102,6 @@ void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, int co
} }
//
// getpixel
//
char getpixel(int32_t x, int32_t y)
{
char r;
#ifdef USE_OPENGL
if (videoGetRenderMode() >= REND_POLYMOST && in3dmode()) return 0;
#endif
videoBeginDrawing(); //{{{
r = readpixel((void *) (ylookup[y]+x+frameplace));
videoEndDrawing(); //}}}
return r;
}
// //
// drawline256 // 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 // after clipping or crashes would ensue
uint32_t drawlinepat = 0xffffffff; 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 odx,ody;
//int32_t ox1=x1,oy1=y1, ox2=x2,oy2=y2; //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; 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, // eccen: eccentricity of the ellipse,
// 16384: circle // 16384: circle
// <16384: shrink in y // <16384: shrink in y
// >16384: grow 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) 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]); px = x1 + mulscale14(r, sintable[l]);
py = y1 + mulscale14(eccen, mulscale14(r, sintable[(l+512)&2047])); py = y1 + mulscale14(eccen, mulscale14(r, sintable[(l+512)&2047]));
drawline16(lpx, lpy, px, py, col); editorDraw2dLine(lpx, lpy, px, py, col);
lpx = px; lpx = px;
lpy = py; lpy = py;
} }
drawline16(lpx, lpy, spx, spy, col); editorDraw2dLine(lpx, lpy, spx, spy, col);
return; return;
} }
@ -609,7 +591,7 @@ void clear2dscreen(void)
int32_t scalescreeny(int32_t sy) { return (m32_sideview) ? mulscale14(sy, m32_sidesin) : sy; } 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) // 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 }; vec2_t coord = { x, y };
@ -656,7 +638,7 @@ int32_t getscreenvdisp(int32_t bz, int32_t zoome)
return mulscale32(bz, zoome*m32_sidecos); return mulscale32(bz, zoome*m32_sidecos);
} }
void setup_sideview_sincos(void) void editorSetup2dSideView(void)
{ {
if (m32_sideview) 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 *p;
vec3_t v; 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; 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 dist1 = m32_sidedist[B_UNBUF16(sw1)];
int32_t dist2 = m32_sidedist[B_UNBUF16(sw2)]; int32_t dist2 = m32_sidedist[B_UNBUF16(sw2)];
@ -710,7 +692,7 @@ static int sideview_cmppoints(const void *sw1, const void *sw2)
// //
// draw2dgrid // 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; 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) if (xinc==0)
{ {
screencoords(&sx1, &sy1, -editorgridextent-posxe, yp2-posye, zoome); editorGet2dScreenCoordinates(&sx1, &sy1, -editorgridextent-posxe, yp2-posye, zoome);
if (yp2 == yp1) if (yp2 == yp1)
{ {
screencoords(&sx2, &sy2, editorgridextent-posxe, yp2-posye, zoome); editorGet2dScreenCoordinates(&sx2, &sy2, editorgridextent-posxe, yp2-posye, zoome);
dx = sx2-sx1; dx = sx2-sx1;
dy = sy2-sy1; 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) else // if (yinc==0)
{ {
screencoords(&sx1, &sy1, xp2-posxe, -editorgridextent-posye, zoome); editorGet2dScreenCoordinates(&sx1, &sy1, xp2-posxe, -editorgridextent-posye, zoome);
if (xp2 == xp1) if (xp2 == xp1)
{ {
screencoords(&sx2, &sy2, xp2-posxe, editorgridextent-posye, zoome); editorGet2dScreenCoordinates(&sx2, &sy2, xp2-posxe, editorgridextent-posye, zoome);
dx = sx2-sx1; dx = sx2-sx1;
dy = sy2-sy1; dy = sy2-sy1;
} }
xp2 += xinc; 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 || if (i==0 || (xp2<-editorgridextent || xp2>editorgridextent ||
yp2<-editorgridextent || yp2>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 >= 0)
{ {
if (xp1 != xp2) if (xp1 != xp2)
drawline16(xp1, yp1, xp1, yp2, editorcolors[25]); editorDraw2dLine(xp1, yp1, xp1, yp2, editorcolors[25]);
} }
} }
if (i >= editorgridextent && xp1 < xdim) if (i >= editorgridextent && xp1 < xdim)
xp2 = xp1; xp2 = xp1;
if (xp2 >= 0 && xp2 < xdim) if (xp2 >= 0 && xp2 < xdim)
drawline16(xp2, yp1, xp2, yp2, editorcolors[25]); editorDraw2dLine(xp2, yp1, xp2, yp2, editorcolors[25]);
} }
// horizontal lines // 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)) if ((yp1 > midydim16-ydim16) && (yp1 <= midydim16))
{ {
drawline16mid(-xp1, -yp1, -xp2, -yp1, editorcolors[25]); editorDraw2dLineMiddle(-xp1, -yp1, -xp2, -yp1, editorcolors[25]);
tempy = yp1; 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]; 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; int const p2 = wal->point2;
int32_t x1, y1, x2, y2; int32_t x1, y1, x2, y2;
screencoords(&x1, &y1, wal->x-posxe, wal->y-posye, zoome); editorGet2dScreenCoordinates(&x1, &y1, wal->x-posxe, wal->y-posye, zoome);
screencoords(&x2, &y2, wall[p2].x-posxe, wall[p2].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 dx = wal->x-wall[p2].x;
int64_t const dy = wal->y-wall[p2].y; 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); fzn = getflorzofslope(wal->nextsector, wal->x, wal->y);
// if (i < wall[j].point2) // 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 #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; int32_t const odrawlinepat = drawlinepat;
fz2 = getflorzofslope(sectorofwall(nw), wall[nw].x, wall[nw].y); fz2 = getflorzofslope(sectorofwall(nw), wall[nw].x, wall[nw].y);
drawlinepat = 0x11111111; drawlinepat = 0x11111111;
drawline16mid(x1, y1, x1, y1+getscreenvdisp(fz2-fz, zoome), col); editorDraw2dLineMiddle(x1, y1, x1, y1+getscreenvdisp(fz2-fz, zoome), col);
drawlinepat = odrawlinepat; 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; int32_t const one=(klabs(x2-x1) >= klabs(y2-y1)), no=!one;
drawline16mid(x1+no, y1+one, x2+no, y2+one, col); editorDraw2dLineMiddle(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);
} }
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 // Draw height indicators at center of walls if requested and if not in
// side-view mode. // 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 dax, day;
int32_t const k = getangle(x1-x2, y1-y2); int32_t const k = getangle(x1-x2, y1-y2);
screencoords(&dax, &day, editorGet2dScreenCoordinates(&dax, &day,
((wal->x+wall[wal->point2].x)>>1)-posxe, ((wal->x+wall[wal->point2].x)>>1)-posxe,
((wal->y+wall[wal->point2].y)>>1)-posye, zoome); ((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 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); 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) 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 dx = mulscale11(sintable[(k+2048)&2047], min(4096, zoome)) / 2560;
int32_t const dy = scalescreeny(mulscale11(sintable[(k+1536)&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 const picnum = sprite[spr].picnum;
int pal = sprite[spr].pal; int pal = sprite[spr].pal;
@ -1072,7 +1054,7 @@ int32_t getspritecol(int32_t spr)
return palookup[pal][tilecols[picnum]]; 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; int32_t x1, y1, x2, y2;
int col; int col;
@ -1088,7 +1070,7 @@ static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32
if (spr->sectnum<0) if (spr->sectnum<0)
col = editorcolors[4]; // red col = editorcolors[4]; // red
else else
col = spritecol ? editorcolors[spritecol] : blocking ? editorcolors[5] : getspritecol(j); col = spritecol ? editorcolors[spritecol] : blocking ? editorcolors[5] : editorGet2dSpriteColor(j);
if (editstatus == 1) 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; // tempint = ((midydim16+y1)*bytesperline)+(halfxdim16+x1)+frameplace;
if (m32_sideview) 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)) (midydim16+y1 >= -f) && (midydim16+y1 < ydim16+f))
{ {
if (zoome > 512 && spr->clipdist > 32) 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; x2 = mulscale11(sintable[(spr->ang+angofs+2560)&2047], zoome) / 768;
y2 = mulscale11(sintable[(spr->ang+angofs+2048)&2047], zoome) / 768; y2 = mulscale11(sintable[(spr->ang+angofs+2048)&2047], zoome) / 768;
y2 = scalescreeny(y2); y2 = scalescreeny(y2);
drawline16mid(x1, y1, x1+x2, y1+y2, col); editorDraw2dLineMiddle(x1, y1, x1+x2, y1+y2, col);
if (hitblocking) if (hitblocking)
{ {
drawline16mid(x1, y1+1, x1+x2, y1+y2+1, col); editorDraw2dLineMiddle(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);
drawline16mid(x1-1, y1, x1+x2-1, y1+y2, col); editorDraw2dLineMiddle(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);
} }
if (flooraligned) 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--) for (ii=3; ii>=0; ii--)
{ {
in = (ii+1)&3; 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) if (hitblocking)
{ {
drawline16mid(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);
drawline16mid(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);
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]+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]-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; 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 = mulscale11(sintable[(spr->ang+angofs+2048)&2047], zoome) / 6144;
y2 = scalescreeny(y2); 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 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) if (hitblocking)
{ {
drawline16mid(x1-no, y1-one, x1-x2-no, y1-y2-one, col); editorDraw2dLineMiddle(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);
} }
} }
if (hitblocking) if (hitblocking)
{ {
drawline16mid(x1-no, y1-one, x1+x2-no, y1+y2-one, col); editorDraw2dLineMiddle(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);
} }
@ -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 = mulscale13(sintable[(spr->ang+angofs+512)&2047], zoome) * fx / 4096;
y2 = scalescreeny(y2); y2 = scalescreeny(y2);
drawline16mid(x1, y1, x1-x2, y1-y2, col); editorDraw2dLineMiddle(x1, y1, x1-x2, y1-y2, col);
drawline16mid(x1, y1, x1+x2, y1+y2, col); editorDraw2dLineMiddle(x1, y1, x1+x2, y1+y2, col);
if (hitblocking) if (hitblocking)
{ {
drawline16mid(x1+1, y1, x1+x2+1, y1+y2, col); editorDraw2dLineMiddle(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);
drawline16mid(x1-1, y1, x1+x2-1, y1+y2, col); editorDraw2dLineMiddle(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);
drawline16mid(x1, y1-1, x1+x2, y1+y2-1, col); editorDraw2dLineMiddle(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);
drawline16mid(x1, y1+1, x1+x2, y1+y2+1, col); editorDraw2dLineMiddle(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);
} }
} }
} }
@ -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]; 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; int32_t i, x1, y1;
int16_t angofs = m32_sideview ? m32_sideang : 0; 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; if (in3dmode()) return;
setup_sideview_sincos(); editorSetup2dSideView();
videoBeginDrawing(); //{{{ videoBeginDrawing(); //{{{
@ -1254,7 +1236,7 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z
clear2dscreen(); clear2dscreen();
// faketimerhandler(); // faketimerhandler();
draw2dgrid(posxe, posye, posze, cursectnum, ange, zoome, gride); editorDraw2dGrid(posxe, posye, posze, cursectnum, ange, zoome, gride);
} }
faketimerhandler(); faketimerhandler();
@ -1279,16 +1261,16 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z
{ {
#ifndef YAX_ENABLE #ifndef YAX_ENABLE
for (i=numwalls-1; i>=0; i--) for (i=numwalls-1; i>=0; i--)
drawscreen_drawwall(i, posxe, posye, posze, zoome, 0); editorDraw2dWall(i, posxe, posye, posze, zoome, 0);
#else #else
if (alwaysshowgray) if (alwaysshowgray)
for (i=numwalls-1; i>=0; i--) for (i=numwalls-1; i>=0; i--)
if (graybitmap[i>>3]&(1<<(i&7))) 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--) for (i=numwalls-1; i>=0; i--)
if ((graybitmap[i>>3]&(1<<(i&7)))==0) if ((graybitmap[i>>3]&(1<<(i&7)))==0)
drawscreen_drawwall(i, posxe, posye, posze, zoome, 2); editorDraw2dWall(i, posxe, posye, posze, zoome, 2);
#endif #endif
} }
else 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<sector[i].wallptr+sector[i].wallnum; j++) for (j=sector[i].wallptr; j<sector[i].wallptr+sector[i].wallnum; j++)
{ {
m32_wallsprite[m32_swcnt++] = j; m32_wallsprite[m32_swcnt++] = j;
sideview_getdist(j, i); editorGet2dSideViewDistance(j, i);
} }
// j = sector[numsectors-1].wallptr + sector[numsectors-1].wallnum // j = sector[numsectors-1].wallptr + sector[numsectors-1].wallnum
for (; j < numwalls; j++) // new walls ... for (; j < numwalls; j++) // new walls ...
{ {
m32_wallsprite[m32_swcnt++] = j; m32_wallsprite[m32_swcnt++] = j;
sideview_getdist(j, 0); editorGet2dSideViewDistance(j, 0);
} }
} }
@ -1327,11 +1309,11 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z
} }
if (!m32_sideview) if (!m32_sideview)
drawscreen_drawsprite(j, posxe, posye, posze, zoome); editorDraw2dSprite(j, posxe, posye, posze, zoome);
else else
{ {
m32_wallsprite[m32_swcnt++] = MAXWALLS+j; m32_wallsprite[m32_swcnt++] = MAXWALLS+j;
sideview_getdist(MAXWALLS+j, -1); editorGet2dSideViewDistance(MAXWALLS+j, -1);
} }
} }
@ -1339,7 +1321,7 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z
if (m32_sideview) if (m32_sideview)
{ {
qsort(m32_wallsprite, m32_swcnt, sizeof(int16_t), &sideview_cmppoints); qsort(m32_wallsprite, m32_swcnt, sizeof(int16_t), &editorCompare2dSideViewPoints);
for (i=0; i<m32_swcnt; i++) // shouldn't it go the other way around? for (i=0; i<m32_swcnt; i++) // shouldn't it go the other way around?
{ {
@ -1347,14 +1329,14 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z
if (j<MAXWALLS) if (j<MAXWALLS)
{ {
if (alwaysshowgray || !(graybitmap[j>>3]&(1<<(j&7)))) if (alwaysshowgray || !(graybitmap[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 else
{ {
if (!alwaysshowgray && sprite[j-MAXWALLS].sectnum>=0) if (!alwaysshowgray && sprite[j-MAXWALLS].sectnum>=0)
YAX_SKIPSECTOR(sprite[j-MAXWALLS].sectnum); 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); i = scalescreeny(x1);
int32_t j = scalescreeny(y1); int32_t j = scalescreeny(y1);
drawline16mid(x1, j, -x1, -j, editorcolors[15]); editorDraw2dLineMiddle(x1, j, -x1, -j, editorcolors[15]);
drawline16mid(x1, j, +y1, -i, editorcolors[15]); editorDraw2dLineMiddle(x1, j, +y1, -i, editorcolors[15]);
drawline16mid(x1, j, -y1, +i, editorcolors[15]); editorDraw2dLineMiddle(x1, j, -y1, +i, editorcolors[15]);
videoEndDrawing(); //}}} videoEndDrawing(); //}}}
@ -1393,7 +1375,7 @@ void draw2dscreen(const vec3_t *pos, int16_t cursectnum, int16_t ange, int32_t z
// setpolymost2dview // setpolymost2dview
// Sets OpenGL for 2D drawing // Sets OpenGL for 2D drawing
// //
void setpolymost2dview(void) void polymostSet2dView(void)
{ {
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (videoGetRenderMode() < REND_POLYMOST) return; if (videoGetRenderMode() < REND_POLYMOST) return;

View file

@ -319,7 +319,7 @@ static int32_t osdfunc_setrendermode(osdfuncparm_t const * const parm)
baselayer_osdcmd_vidmode_func(&parm); baselayer_osdcmd_vidmode_func(&parm);
} }
setrendermode(m); videoSetRenderMode(m);
char const *renderer; char const *renderer;

View file

@ -531,7 +531,7 @@ void M32_DrawRoomsAndMasks(void)
CallExtAnalyzeSprites(0,0,0,0); CallExtAnalyzeSprites(0,0,0,0);
searchwall = osearchwall, searchstat=osearchstat; searchwall = osearchwall, searchstat=osearchstat;
drawmasks(); renderDrawMasks();
srchwall = (searchstat == 3) ? searchwall : -1; srchwall = (searchstat == 3) ? searchwall : -1;
M32_ResetFakeRORTiles(); M32_ResetFakeRORTiles();
@ -541,7 +541,7 @@ void M32_DrawRoomsAndMasks(void)
polymer_editorpick(); polymer_editorpick();
drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum); drawrooms(pos.x,pos.y,pos.z,ang,horiz,cursectnum);
CallExtAnalyzeSprites(0,0,0,0); CallExtAnalyzeSprites(0,0,0,0);
drawmasks(); renderDrawMasks();
M32_ResetFakeRORTiles(); M32_ResetFakeRORTiles();
} }
#endif #endif
@ -550,14 +550,14 @@ void M32_DrawRoomsAndMasks(void)
if (g_doScreenShot) if (g_doScreenShot)
{ {
screencapture("mcapxxxx.tga", 0); videoCaptureScreen("mcapxxxx.tga", 0);
g_doScreenShot = 0; g_doScreenShot = 0;
} }
if (r_usenewaspect) if (r_usenewaspect)
{ {
newaspect_enable = 0; 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)); Bstrncpy(game_executable, DefaultGameLocalExec, sizeof(game_executable));
if (preinitengine()) if (enginePreInit())
M32_FatalEngineError(); M32_FatalEngineError();
if ((i = CallExtInit()) < 0) return -1; if ((i = CallExtInit()) < 0) return -1;
@ -660,7 +660,7 @@ int app_main(int argc, char const * const * argv)
{ {
if (quitevent || !startwin_run()) if (quitevent || !startwin_run())
{ {
uninitengine(); engineUnInit();
Bexit(0); Bexit(0);
} }
} }
@ -691,7 +691,7 @@ int app_main(int argc, char const * const * argv)
free(m); free(m);
g_defModules.clear(); g_defModules.clear();
if (E_PostInit()) if (enginePostInit())
M32_FatalEngineError(); M32_FatalEngineError();
CallExtPostInit(); CallExtPostInit();
@ -722,7 +722,7 @@ int app_main(int argc, char const * const * argv)
cacheAllocateBlock(&waloff[i], sx*sy, &walock[i]); cacheAllocateBlock(&waloff[i], sx*sy, &walock[i]);
newtile = (char *)waloff[i]; newtile = (char *)waloff[i];
col = getclosestcol(128, 128, 0); col = paletteGetClosestColor(128, 128, 0);
for (j=0; j<(signed)sizeof(R); j++) for (j=0; j<(signed)sizeof(R); j++)
R[j] *= col; R[j] *= col;
@ -733,7 +733,7 @@ int app_main(int argc, char const * const * argv)
#endif #endif
#ifdef HAVE_CLIPSHAPE_FEATURE #ifdef HAVE_CLIPSHAPE_FEATURE
int k = clipmapinfo_load(); int k = engineLoadClipMaps();
if (k>0) if (k>0)
initprintf("There was an error loading the sprite clipping map (status %d).\n", k); 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) if (videoSetGameMode(fullscreen, xdim2d, ydim2d, 8) < 0)
{ {
CallExtUnInit(); CallExtUnInit();
uninitengine(); engineUnInit();
Bprintf("%d * %d not supported in this graphics mode\n",xdim2d,ydim2d); Bprintf("%d * %d not supported in this graphics mode\n",xdim2d,ydim2d);
Bexit(0); Bexit(0);
} }
@ -795,7 +795,7 @@ int app_main(int argc, char const * const * argv)
if (videoSetGameMode(fullscreen, xdimgame, ydimgame, bppgame) < 0) if (videoSetGameMode(fullscreen, xdimgame, ydimgame, bppgame) < 0)
{ {
CallExtUnInit(); CallExtUnInit();
uninitengine(); engineUnInit();
Bprintf("%d * %d not supported in this graphics mode\n",xdim,ydim); Bprintf("%d * %d not supported in this graphics mode\n",xdim,ydim);
Bexit(0); Bexit(0);
} }
@ -913,7 +913,7 @@ CANCEL:
CallExtUnInit(); CallExtUnInit();
// clearfilenames(); // clearfilenames();
uninitengine(); engineUnInit();
return 0; return 0;
} }
@ -929,7 +929,7 @@ static void loadmhk(int32_t domessage)
Bstrcpy(levname, boardfilename); Bstrcpy(levname, boardfilename);
append_ext_UNSAFE(levname, ".mhk"); append_ext_UNSAFE(levname, ".mhk");
if (!loadmaphack(levname)) if (!engineLoadMHK(levname))
{ {
if (domessage) if (domessage)
message("Loaded map hack file \"%s\"",levname); 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 // F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL
mousz = 0; mousz = 0;
getmousevalues(&mousx,&mousy,&bstatus); mouseGetValues(&mousx,&mousy,&bstatus);
mousx = (mousx<<16) + mousexsurp; mousx = (mousx<<16) + mousexsurp;
mousy = (mousy<<16) + mouseysurp; mousy = (mousy<<16) + mouseysurp;
@ -1228,7 +1228,7 @@ void editinput(void)
{ {
Bmemset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES); Bmemset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES);
Bmemset(spritesmooth, 0, sizeof(spritesmooth_t) * (MAXSPRITES+MAXUNIQHUDID)); Bmemset(spritesmooth, 0, sizeof(spritesmooth_t) * (MAXSPRITES+MAXUNIQHUDID));
delete_maphack_lights(); engineClearLightsFromMHK();
mhk = 0; mhk = 0;
message("Maphacks disabled"); 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; 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].y += getscreenvdisp(getflorzofslope(sectnum,wall[oi].x,wall[oi].y)-pos->z, zoom);
wall[i].x += halfxdim16; wall[i].x += halfxdim16;
wall[i].y += midydim16; 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) 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) 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) if (m32_sideview)
day += getscreenvdisp(daz-pos.z, zoom); 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); printext16(x1,y1, col,backcol, text,1);
drawline16(x1-2, y1-2, x2-2, y1-2, border); editorDraw2dLine(x1-2, y1-2, x2-2, y1-2, border);
drawline16(x1-2, y2+1, x2-2, y2+1, border); editorDraw2dLine(x1-2, y2+1, x2-2, y2+1, border);
drawline16(x1-3, y1-1, x1-3, y2+0, border); editorDraw2dLine(x1-3, y1-1, x1-3, y2+0, border);
drawline16(x2-1, y1-1, x2-1, y2+0, border); editorDraw2dLine(x2-1, y1-1, x2-1, y2+0, border);
drawline16(x1-1,y1-1, x2-3,y1-1, backcol); editorDraw2dLine(x1-1,y1-1, x2-3,y1-1, backcol);
drawline16(x1-1,y2+0, x2-3,y2+0, backcol); editorDraw2dLine(x1-1,y2+0, x2-3,y2+0, backcol);
drawline16(x1-2,y1+0, x1-2,y2-1, backcol); editorDraw2dLine(x1-2,y1+0, x1-2,y2-1, backcol);
drawline16(x2-2,y1+0, x2-2,y2-1, backcol); editorDraw2dLine(x2-2,y1+0, x2-2,y2-1, backcol);
drawline16(x2-3,y1+0, x2-3,y2+0, backcol); editorDraw2dLine(x2-3,y1+0, x2-3,y2+0, backcol);
videoBeginDrawing(); //{{{ 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; int32_t x1, x2, y1, y2;
screencoords(&x1,&y1, v1->x-pos.x,v1->y-pos.y, zoom); editorGet2dScreenCoordinates(&x1,&y1, v1->x-pos.x,v1->y-pos.y, zoom);
screencoords(&x2,&y2, v2->x-pos.x,v2->y-pos.y, zoom); editorGet2dScreenCoordinates(&x2,&y2, v2->x-pos.x,v2->y-pos.y, zoom);
if (m32_sideview) if (m32_sideview)
{ {
@ -3240,7 +3240,7 @@ static void drawlinebetween(const vec3_t *v1, const vec3_t *v2, int32_t col, uin
} }
drawlinepat = pat; drawlinepat = pat;
drawline16(xofs+x1,yofs+y1, xofs+x2,yofs+y2, col); editorDraw2dLine(xofs+x1,yofs+y1, xofs+x2,yofs+y2, col);
drawlinepat = opat; drawlinepat = opat;
} }
@ -3307,7 +3307,7 @@ static void drawspritelabel(int i)
// KEEPINSYNC drawscreen_drawsprite() // KEEPINSYNC drawscreen_drawsprite()
uspritetype const * s = (uspritetype *)&sprite[i]; uspritetype const * s = (uspritetype *)&sprite[i];
uint8_t const spritecol = spritecol2d[s->picnum][(s->cstat&1)]; 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 const blocking = s->cstat & 1;
int bordercol = blocking ? editorcolors[5] : col; int bordercol = blocking ? editorcolors[5] : col;
@ -3459,7 +3459,7 @@ void overheadeditor(void)
if (!m32_is2d3dmode()) if (!m32_is2d3dmode())
{ {
oldmousebstatus = bstatus; oldmousebstatus = bstatus;
getmousevalues(&mousx, &mousy, &bstatus); mouseGetValues(&mousx, &mousy, &bstatus);
{ {
int32_t bs = bstatus; int32_t bs = bstatus;
@ -3513,7 +3513,7 @@ void overheadeditor(void)
clear2dscreen(); clear2dscreen();
setup_sideview_sincos(); editorSetup2dSideView();
VM_OnEvent(EVENT_PREDRAW2DSCREEN, -1); VM_OnEvent(EVENT_PREDRAW2DSCREEN, -1);
@ -3531,15 +3531,15 @@ void overheadeditor(void)
if (graphicsmode == 2) if (graphicsmode == 2)
totalclocklock = totalclock; 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(); CallExtPreCheckKeys();
draw2dscreen(&pos,cursectnum,ang,zoom,grid); editorDraw2dScreen(&pos,cursectnum,ang,zoom,grid);
// Draw brown arrow (start) // 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) if (m32_sideview)
y2 += getscreenvdisp(startpos.z-pos.z, zoom); y2 += getscreenvdisp(startpos.z-pos.z, zoom);
@ -3684,8 +3684,8 @@ void overheadeditor(void)
if (!m32_is2d3dmode() && (m32_sideview || highlightcnt <= 0)) if (!m32_is2d3dmode() && (m32_sideview || highlightcnt <= 0))
{ {
drawlinepat = 0x00ff00ff; drawlinepat = 0x00ff00ff;
drawline16(searchx,0, searchx,ydim2d-1, editorcolors[15]); editorDraw2dLine(searchx,0, searchx,ydim2d-1, editorcolors[15]);
drawline16(0,searchy, xdim2d-1,searchy, editorcolors[15]); editorDraw2dLine(0,searchy, xdim2d-1,searchy, editorcolors[15]);
drawlinepat = 0xffffffff; drawlinepat = 0xffffffff;
_printmessage16("(%d,%d)",mousxplc,mousyplc); _printmessage16("(%d,%d)",mousxplc,mousyplc);
@ -3840,8 +3840,8 @@ void overheadeditor(void)
} }
} }
drawline16(searchx,0, searchx,8, editorcolors[15]); editorDraw2dLine(searchx,0, searchx,8, editorcolors[15]);
drawline16(0,searchy, 8,searchy, editorcolors[15]); editorDraw2dLine(0,searchy, 8,searchy, editorcolors[15]);
// 2d3d mode // 2d3d mode
if (m32_2d3dmode && m32_2d3d_resolutions_match()) if (m32_2d3dmode && m32_2d3d_resolutions_match())
@ -3897,10 +3897,10 @@ void overheadeditor(void)
searchy = osearch.y; searchy = osearch.y;
videoBeginDrawing(); videoBeginDrawing();
drawline16(m32_2d3d.x, m32_2d3d.y, m32_2d3d.x + XSIZE_2D3D, m32_2d3d.y, editorcolors[15]); editorDraw2dLine(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]); editorDraw2dLine(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]); editorDraw2dLine(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 + YSIZE_2D3D, m32_2d3d.x + XSIZE_2D3D, m32_2d3d.y + YSIZE_2D3D, editorcolors[15]);
} }
} }
@ -4168,7 +4168,7 @@ void overheadeditor(void)
{ {
keystatus[88] = 0; keystatus[88] = 0;
//__clearscreen_beforecapture__ //__clearscreen_beforecapture__
screencapture("captxxxx.tga", eitherSHIFT); videoCaptureScreen("captxxxx.tga", eitherSHIFT);
videoShowFrame(1); videoShowFrame(1);
} }
@ -5071,7 +5071,7 @@ end_yax: ;
} }
else 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( ty += getscreenvdisp(
getflorzofslope(sectorofwall(i), wall[i].x,wall[i].y)-pos.z, zoom); getflorzofslope(sectorofwall(i), wall[i].x,wall[i].y)-pos.z, zoom);
tx += halfxdim16; tx += halfxdim16;
@ -5120,7 +5120,7 @@ end_yax: ;
} }
else 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); ty += getscreenvdisp(sprite[i].z-pos.z, zoom);
tx += halfxdim16; tx += halfxdim16;
ty += midydim16; ty += midydim16;
@ -5439,7 +5439,7 @@ end_autoredwall:
} }
else 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); ty += getscreenvdisp(getflorzofslope(i, wall[j].x,wall[j].y)-pos.z, zoom);
tx += halfxdim16; tx += halfxdim16;
ty += midydim16; ty += midydim16;
@ -8230,7 +8230,7 @@ CANCEL:
CallExtUnInit(); CallExtUnInit();
// clearfilenames(); // clearfilenames();
uninitengine(); engineUnInit();
Bexit(0); Bexit(0);
} }
@ -8266,7 +8266,7 @@ CANCEL:
initprintf("%d * %d not supported in this graphics mode\n",xdim,ydim); initprintf("%d * %d not supported in this graphics mode\n",xdim,ydim);
CallExtUnInit(); CallExtUnInit();
// clearfilenames(); // clearfilenames();
uninitengine(); engineUnInit();
Bexit(1); Bexit(1);
} }
@ -8464,9 +8464,9 @@ int32_t LoadBoard(const char *filename, uint32_t flags)
editorzrange[1] = INT32_MAX; editorzrange[1] = INT32_MAX;
CallExtPreLoadMap(); CallExtPreLoadMap();
i = loadboard(filename, (flags&4)|loadingflags, &pos, &ang, &cursectnum); i = engineLoadBoard(filename, (flags&4)|loadingflags, &pos, &ang, &cursectnum);
if (i == -2) if (i == -2)
i = loadoldboard(filename,loadingflags, &pos, &ang, &cursectnum); i = engineLoadBoardV5V6(filename,loadingflags, &pos, &ang, &cursectnum);
if (i < 0) 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); dst = klabs(xplc-wall[j].x) + klabs(yplc-wall[j].y);
else 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); 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) 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 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); day += getscreenvdisp(sprite[i].z-pos.z, zoom);
if (halfxdim16+dax < 0 || halfxdim16+dax >= xdim || midydim16+day < 0 || midydim16+day >= ydim) 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; endwall = startwall + sector[sectnum].wallnum - 1;
for (z=startwall; z<=endwall; z++) 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) if (m32_sideview)
y1 += getscreenvdisp(getflorzofslope(sectnum,wall[z].x,wall[z].y)-pos.z, zoom); 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) if (fillist[z+1] > rborder)
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]
} }
} }
} }

View file

@ -13,7 +13,7 @@ static int16_t clipobjectval[MAXCLIPNUM];
////// sector-like clipping for sprites ////// ////// sector-like clipping for sprites //////
#ifdef HAVE_CLIPSHAPE_FEATURE #ifdef HAVE_CLIPSHAPE_FEATURE
void mapinfo_set(mapinfo_t *bak, mapinfo_t *newmap) void engineSetClipMap(mapinfo_t *bak, mapinfo_t *newmap)
{ {
if (bak) if (bak)
{ {
@ -49,7 +49,7 @@ static uwalltype *loadwall, *loadwallinv;
static uspritetype *loadsprite; static uspritetype *loadsprite;
void clipmapinfo_init() void engineInitClipMaps()
{ {
numclipmaps = 0; numclipmaps = 0;
numclipsects = 0; numclipsects = 0;
@ -72,7 +72,7 @@ void clipmapinfo_init()
// loads the clip maps. // loads the clip maps.
// this should be called before any real map is loaded. // this should be called before any real map is loaded.
int32_t clipmapinfo_load(void) int32_t engineLoadClipMaps(void)
{ {
int32_t i, k, w; int32_t i, k, w;
@ -85,7 +85,7 @@ int32_t clipmapinfo_load(void)
int32_t ournumsectors=0, ournumwalls=0, ournumsprites=0; int32_t ournumsectors=0, ournumwalls=0, ournumsprites=0;
clipmapinfo_init(); engineInitClipMaps();
loadsector = (usectortype *) Xmalloc(MAXSECTORS * sizeof(sectortype)); loadsector = (usectortype *) Xmalloc(MAXSECTORS * sizeof(sectortype));
loadwall = (uwalltype *) Xmalloc(MAXWALLS * sizeof(walltype)); loadwall = (uwalltype *) Xmalloc(MAXWALLS * sizeof(walltype));
@ -105,7 +105,7 @@ int32_t clipmapinfo_load(void)
fisec[fi] = ournumsectors; fisec[fi] = ournumsectors;
fispr[fi] = ournumsprites; fispr[fi] = ournumsprites;
i = loadboard(g_clipMapFiles[fi], 8, &tmppos, &ang, &cs); i = engineLoadBoard(g_clipMapFiles[fi], 8, &tmppos, &ang, &cs);
if (i<0) if (i<0)
continue; continue;
// Numsprites will now be set! // Numsprites will now be set!
@ -148,7 +148,7 @@ int32_t clipmapinfo_load(void)
if (ournumsectors==0 || ournumwalls==0 || ournumsprites==0) // nothing loaded if (ournumsectors==0 || ournumwalls==0 || ournumsprites==0) // nothing loaded
{ {
clipmapinfo_init(); engineInitClipMaps();
Bfree(fisec); Bfree(fisec);
Bfree(fispr); 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" 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], " already belongs to picnum %d.\n", g_clipMapFiles[fi], pn, i-fispr[fi], k-fisec[fi],
clipinfo[sectoidx[k]].picnum); clipinfo[sectoidx[k]].picnum);
clipmapinfo_init(); engineInitClipMaps();
Bfree(fisec); Bfree(fisec);
Bfree(fispr); Bfree(fispr);
@ -298,7 +298,7 @@ int32_t clipmapinfo_load(void)
break; break;
initprintf("clip map \"%s\": error: encountered more than one outer sector (%d and %d)" 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]); " for sprite %d.\n", g_clipMapFiles[fi], outersect-fisec[fi], ns-fisec[fi], i-fispr[fi]);
clipmapinfo_init(); engineInitClipMaps();
Bfree(fisec); Bfree(fisec);
Bfree(fispr); Bfree(fispr);
@ -317,7 +317,7 @@ int32_t clipmapinfo_load(void)
initprintf("clip map \"%s\": error: encountered sector %d belonging to index %d" initprintf("clip map \"%s\": error: encountered sector %d belonging to index %d"
" while collecting sectors for sprite %d (index %d).\n", " while collecting sectors for sprite %d (index %d).\n",
g_clipMapFiles[fi], ns-fisec[fi], sectoidx[ns], i-fispr[fi], numclipmaps); g_clipMapFiles[fi], ns-fisec[fi], sectoidx[ns], i-fispr[fi], numclipmaps);
clipmapinfo_init(); engineInitClipMaps();
Bfree(fisec); Bfree(fisec);
Bfree(fispr); Bfree(fispr);
@ -331,7 +331,7 @@ int32_t clipmapinfo_load(void)
if (outersect==-1) if (outersect==-1)
{ {
initprintf("clip map: INTERNAL ERROR: outersect==-1!\n"); initprintf("clip map: INTERNAL ERROR: outersect==-1!\n");
clipmapinfo_init(); engineInitClipMaps();
Bfree(fisec); Bfree(fisec);
Bfree(fispr); Bfree(fispr);
@ -916,7 +916,7 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum,
Bmemcpy(origclipsectorlist, clipsectorlist, clipsectnum*sizeof(clipsectorlist[0])); Bmemcpy(origclipsectorlist, clipsectorlist, clipsectnum*sizeof(clipsectorlist[0]));
// replace sector and wall with clip map // replace sector and wall with clip map
mapinfo_set(&origmapinfo, &clipmapinfo); engineSetClipMap(&origmapinfo, &clipmapinfo);
} }
curspr = (uspritetype *)&sprite[clipspritelist[clipspritecnt]]; curspr = (uspritetype *)&sprite[clipspritelist[clipspritecnt]];
@ -1175,7 +1175,7 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum,
if (curspr) if (curspr)
{ {
// restore original map // restore original map
mapinfo_set(NULL, &origmapinfo); engineSetClipMap(NULL, &origmapinfo);
clipsectnum = origclipsectnum; clipsectnum = origclipsectnum;
Bmemcpy(clipsectorlist, origclipsectorlist, clipsectnum*sizeof(clipsectorlist[0])); Bmemcpy(clipsectorlist, origclipsectorlist, clipsectnum*sizeof(clipsectorlist[0]));

View file

@ -250,7 +250,7 @@ void COMMON_clearbackground(int32_t numcols, int32_t numrows)
polymost_setFogEnabled(false); polymost_setFogEnabled(false);
polymost_useColorOnly(true); polymost_useColorOnly(true);
setpolymost2dview(); polymostSet2dView();
glColor4f(0.f, 0.f, 0.f, 0.67f); glColor4f(0.f, 0.f, 0.f, 0.67f);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glRecti(0, 0, xdim, 8*numrows+8); glRecti(0, 0, xdim, 8*numrows+8);

View file

@ -2679,7 +2679,7 @@ static int32_t defsparser(scriptfile *script)
break; break;
} }
psky_t * const newpsky = E_DefinePsky(tile); psky_t * const newpsky = tileSetupSky(tile);
while (script->textptr < blockend) while (script->textptr < blockend)
{ {

View file

@ -195,9 +195,9 @@ int32_t circlewall=-1;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void setup_sideview_sincos(void); void editorSetup2dSideView(void);
int32_t getscreenvdisp(int32_t bz, int32_t zoome); 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); int32_t scalescreeny(int32_t sy);
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
void yax_tweakpicnums(int32_t bunchnum, int32_t cf, int32_t restore); 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]; int32_t odsprcnt = yax_spritesortcnt[yax_globallev];
#endif #endif
// +MAXSECTORS: force // +MAXSECTORS: force
drawrooms_q16(globalposx,globalposy,globalposz,qglobalang,horiz,k+MAXSECTORS); renderDrawRoomsQ16(globalposx,globalposy,globalposz,qglobalang,horiz,k+MAXSECTORS);
if (numhere > 1) if (numhere > 1)
for (i=0; i<(numsectors+7)>>3; i++) for (i=0; i<(numsectors+7)>>3; i++)
lgotsector[i] |= gotsector[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--) for (nmp=r_tror_nomaskpass; nmp>=0; nmp--)
{ {
yax_nomaskpass = 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) 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); (double)(1000*(timerGetTicksU64()-t))/u64tickspersec);
SpriteAnimFunc(globalposx, globalposy, globalang, smoothr); SpriteAnimFunc(globalposx, globalposy, globalang, smoothr);
drawmasks(); renderDrawMasks();
} }
if (lev < maxlev[cf]) if (lev < maxlev[cf])
@ -1098,7 +1098,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t),
scansector_collectsprites = 0; scansector_collectsprites = 0;
// draw base level // draw base level
drawrooms_q16(globalposx,globalposy,globalposz,qglobalang,horiz, renderDrawRoomsQ16(globalposx,globalposy,globalposz,qglobalang,horiz,
osectnum + MAXSECTORS*didmirror); osectnum + MAXSECTORS*didmirror);
// if (scansector_collectsprites) // if (scansector_collectsprites)
// spritesortcnt = 0; // spritesortcnt = 0;
@ -1119,8 +1119,8 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t),
#ifdef YAX_DEBUG_YMOSTS #ifdef YAX_DEBUG_YMOSTS
if (videoGetRenderMode() == REND_CLASSIC && numyaxbunches>0) if (videoGetRenderMode() == REND_CLASSIC && numyaxbunches>0)
{ {
char purple = getclosestcol(255, 0, 255); char purple = paletteGetClosestColor(255, 0, 255);
char yellow = getclosestcol(255, 255, 0); char yellow = paletteGetClosestColor(255, 255, 0);
videoBeginDrawing(); videoBeginDrawing();
for (i=0; i<numyaxbunches; i++) for (i=0; i<numyaxbunches; i++)
@ -4315,8 +4315,8 @@ static void drawalls(int32_t bunch)
# endif # endif
{ {
static char fn[32], tmpbuf[80]; static char fn[32], tmpbuf[80];
char purple = getclosestcol(255, 0, 255); char purple = paletteGetClosestColor(255, 0, 255);
char yellow = getclosestcol(255, 255, 0); char yellow = paletteGetClosestColor(255, 255, 0);
char *bakframe = (char *)Xaligned_alloc(16, xdim*ydim); char *bakframe = (char *)Xaligned_alloc(16, xdim*ydim);
videoBeginDrawing(); //{{{ videoBeginDrawing(); //{{{
@ -4342,7 +4342,7 @@ static void drawalls(int32_t bunch)
printext256(8,8, whitecol,0, tmpbuf, 0); printext256(8,8, whitecol,0, tmpbuf, 0);
Bsprintf(fn, "engshot%04d.png", engine_screenshot); Bsprintf(fn, "engshot%04d.png", engine_screenshot);
screencapture(fn, 0); videoCaptureScreen(fn, 0);
engine_screenshot++; engine_screenshot++;
Bmemcpy((char *)frameplace, bakframe, xdim*ydim); Bmemcpy((char *)frameplace, bakframe, xdim*ydim);
@ -7151,7 +7151,7 @@ static inline void calcbritable(void)
#define BANG2RAD (fPI * (1.f/1024.f)) #define BANG2RAD (fPI * (1.f/1024.f))
static int32_t loadtables(void) static int32_t engineLoadTables(void)
{ {
static char tablesloaded = 0; static char tablesloaded = 0;
@ -7501,7 +7501,7 @@ int32_t rayintersect(int32_t x1, int32_t y1, int32_t z1, int32_t vx, int32_t vy,
// multi-pskies // multi-pskies
// //
psky_t * E_DefinePsky(int32_t const tilenum) psky_t * tileSetupSky(int32_t const tilenum)
{ {
for (bssize_t i = 0; i < pskynummultis; i++) for (bssize_t i = 0; i < pskynummultis; i++)
if (multipskytile[i] == tilenum) if (multipskytile[i] == tilenum)
@ -7569,7 +7569,7 @@ static void sighandler(int sig, siginfo_t *info, void *ctx)
// //
// E_FatalError // E_FatalError
// //
int32_t E_FatalError(char const * const msg) int32_t engineFatalError(char const * const msg)
{ {
engineerrstr = msg; engineerrstr = msg;
initprintf("ERROR: %s\n", engineerrstr); initprintf("ERROR: %s\n", engineerrstr);
@ -7597,7 +7597,7 @@ static spritetype sprite_s[MAXSPRITES];
static uspritetype tsprite_s[MAXSPRITESONSCREEN]; static uspritetype tsprite_s[MAXSPRITESONSCREEN];
#endif #endif
int32_t preinitengine(void) int32_t enginePreInit(void)
{ {
baselayer_init(); baselayer_init();
initdivtables(); initdivtables();
@ -7680,7 +7680,7 @@ int32_t preinitengine(void)
initcrc32table(); initcrc32table();
#ifdef HAVE_CLIPSHAPE_FEATURE #ifdef HAVE_CLIPSHAPE_FEATURE
clipmapinfo_init(); engineInitClipMaps();
#endif #endif
preinitcalled = 1; preinitcalled = 1;
return 0; return 0;
@ -7690,7 +7690,7 @@ int32_t preinitengine(void)
// //
// initengine // initengine
// //
int32_t initengine(void) int32_t engineInit(void)
{ {
int32_t i, j; int32_t i, j;
@ -7704,7 +7704,7 @@ int32_t initengine(void)
if (!preinitcalled) if (!preinitcalled)
{ {
i = preinitengine(); i = enginePreInit();
if (i) return i; if (i) return i;
} }
@ -7714,7 +7714,7 @@ int32_t initengine(void)
u64tickspersec = 1.0; u64tickspersec = 1.0;
#endif #endif
if (loadtables()) if (engineLoadTables())
return 1; return 1;
xyaspect = -1; xyaspect = -1;
@ -7753,13 +7753,13 @@ int32_t initengine(void)
#ifdef LUNATIC #ifdef LUNATIC
if (L_CreateState(&g_engState, "eng", NULL)) if (L_CreateState(&g_engState, "eng", NULL))
return E_FatalError("Failed creating engine Lua state!"); return engineFatalError("Failed creating engine Lua state!");
{ {
static char const * const luastr = "_LUNATIC_AUX=true; decl=require('ffi').cdef; require'defs_common'"; static char const * const luastr = "_LUNATIC_AUX=true; decl=require('ffi').cdef; require'defs_common'";
if (L_RunString(&g_engState, luastr, -1, "eng")) if (L_RunString(&g_engState, luastr, -1, "eng"))
return E_FatalError("Failed setting up engine Lua state"); return engineFatalError("Failed setting up engine Lua state");
} }
#endif #endif
@ -7769,14 +7769,14 @@ int32_t initengine(void)
// //
// E_PostInit // E_PostInit
// //
int32_t E_PostInit(void) int32_t enginePostInit(void)
{ {
if (!(paletteloaded & PALETTE_MAIN)) if (!(paletteloaded & PALETTE_MAIN))
return E_FatalError("No palette found."); return engineFatalError("No palette found.");
if (!(paletteloaded & PALETTE_SHADE)) if (!(paletteloaded & PALETTE_SHADE))
return E_FatalError("No shade table found."); return engineFatalError("No shade table found.");
if (!(paletteloaded & PALETTE_TRANSLUC)) if (!(paletteloaded & PALETTE_TRANSLUC))
return E_FatalError("No translucency table found."); return engineFatalError("No translucency table found.");
palettePostLoadTables(); palettePostLoadTables();
@ -7786,7 +7786,7 @@ int32_t E_PostInit(void)
// //
// uninitengine // uninitengine
// //
void uninitengine(void) void engineUnInit(void)
{ {
#ifdef USE_OPENGL #ifdef USE_OPENGL
polymost_glreset(); polymost_glreset();
@ -7917,8 +7917,8 @@ void set_globalang(fix16_t ang)
// //
// drawrooms // drawrooms
// //
int32_t drawrooms_q16(int32_t daposx, int32_t daposy, int32_t daposz, int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz,
fix16_t daang, fix16_t dahoriz, int16_t dacursectnum) fix16_t daang, fix16_t dahoriz, int16_t dacursectnum)
{ {
int32_t i, j, /*cz, fz,*/ closest; int32_t i, j, /*cz, fz,*/ closest;
int16_t *shortptr1, *shortptr2; int16_t *shortptr1, *shortptr2;
@ -8310,7 +8310,7 @@ int32_t g_maskDrawMode = 0;
// //
// drawmasks // drawmasks
// //
void drawmasks(void) void renderDrawMasks(void)
{ {
#ifdef DEBUG_MASK_DRAWING #ifdef DEBUG_MASK_DRAWING
static struct { static struct {
@ -8659,7 +8659,7 @@ killsprite:
// //
// drawmapview // drawmapview
// //
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)
{ {
int32_t i, j, k, l; int32_t i, j, k, l;
int32_t x, y; int32_t x, y;
@ -8667,7 +8667,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
int32_t const oyxaspect = yxaspect, oviewingrange = viewingrange; int32_t const oyxaspect = yxaspect, oviewingrange = viewingrange;
videoSetAspect(65536, divscale16((320*5)/8, 200)); renderSetAspect(65536, divscale16((320*5)/8, 200));
beforedrawrooms = 0; beforedrawrooms = 0;
@ -8957,9 +8957,9 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
videoEndDrawing(); //}}} videoEndDrawing(); //}}}
if (r_usenewaspect) if (r_usenewaspect)
videoSetAspect(oviewingrange, oyxaspect); renderSetAspect(oviewingrange, oyxaspect);
else else
videoSetAspect(65536, divscale16(ydim*320, xdim*200)); renderSetAspect(65536, divscale16(ydim*320, xdim*200));
} }
//////////////////// LOADING AND SAVING ROUTINES //////////////////// //////////////////// LOADING AND SAVING ROUTINES ////////////////////
@ -8969,7 +8969,7 @@ static FORCE_INLINE int32_t have_maptext(void)
return (mapversion >= 10); return (mapversion >= 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(); 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; 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 // -2: invalid version
// -3: invalid number of sectors, walls or sprites // -3: invalid number of sectors, walls or sprites
// <= -4: map-text error // <= -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; int32_t fil, i;
int16_t numsprites; 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 #ifdef NEW_MAP_FORMAT
if (have_maptext()) 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]))); // 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 // Powerslave uses v6
// Witchaven 1 and TekWar and LameDuke use v5 // 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; int32_t fil, i;
int16_t numsprites; 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); kread(fil,&mapversion,4); mapversion = B_LITTLE32(mapversion);
if (mapversion != 5L && mapversion != 6L) { kclose(fil); return -2; } 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); kread(fil,&numsectors,2); numsectors = B_LITTLE16(numsectors);
if (numsectors > MAXSECTORS) { kclose(fil); return -1; } 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); kclose(fil);
// Done reading file. // 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 // one bunch of sectors completed, prepare the next
if (!curspr) 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]]; curspr = (uspritetype *)&sprite[clipspritelist[clipspritecnt]];
curidx = clipshape_idx_for_sprite(curspr, curidx); curidx = clipshape_idx_for_sprite(curspr, curidx);
@ -10965,7 +10965,7 @@ restart_grand:
#ifdef HAVE_CLIPSHAPE_FEATURE #ifdef HAVE_CLIPSHAPE_FEATURE
if (curspr) if (curspr)
mapinfo_set(NULL, &origmapinfo); engineSetClipMap(NULL, &origmapinfo);
#endif #endif
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
@ -11513,7 +11513,7 @@ void rotatepoint(vec2_t const pivot, vec2_t p, int16_t daang, vec2_t *p2)
// getmousevalues // 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); mouseReadPos(mousx,mousy);
mouseReadButtons(bstatus); mouseReadButtons(bstatus);
@ -11635,7 +11635,7 @@ void getzrange(const vec3_t *pos, int16_t sectnum,
{ {
beginagain: beginagain:
// replace sector and wall with clip map // replace sector and wall with clip map
mapinfo_set(&origmapinfo, &clipmapinfo); engineSetClipMap(&origmapinfo, &clipmapinfo);
clipsectcnt = clipsectnum; // should be a nop, "safety"... clipsectcnt = clipsectnum; // should be a nop, "safety"...
} }
#endif #endif
@ -11804,7 +11804,7 @@ restart_grand:
#ifdef HAVE_CLIPSHAPE_FEATURE #ifdef HAVE_CLIPSHAPE_FEATURE
if (curspr) 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 clipsectnum = clipspritenum = 0; // skip the next for loop and check afterwards
} }
#endif #endif
@ -12048,10 +12048,10 @@ void videoSetCorrectedAspect()
vr = divscale16(x*3, y*4); vr = divscale16(x*3, y*4);
videoSetAspect(vr, yx); renderSetAspect(vr, yx);
} }
else 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 // setaspect
// //
void videoSetAspect(int32_t daxrange, int32_t daaspect) void renderSetAspect(int32_t daxrange, int32_t daaspect)
{ {
viewingrange = daxrange; viewingrange = daxrange;
viewingrangerecip = divscale32(1,daxrange); viewingrangerecip = divscale32(1,daxrange);
@ -12282,7 +12282,7 @@ void videoClearScreen(int32_t dacol)
// //
// setviewtotile // 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 //DRAWROOMS TO TILE BACKUP&SET CODE
tilesiz[tilenume].x = xsiz; tilesiz[tilenume].y = ysiz; 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; offscreenrendering = 1;
videoSetViewableArea(0,0,ysiz-1,xsiz-1); videoSetViewableArea(0,0,ysiz-1,xsiz-1);
videoSetAspect(65536,65536); renderSetAspect(65536,65536);
calc_ylookup(ysiz, xsiz); calc_ylookup(ysiz, xsiz);
} }
@ -12318,7 +12318,7 @@ void videoSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz)
// //
// setviewback // setviewback
// //
void videoRestoreTarget(void) void renderRestoreTarget(void)
{ {
if (setviewcnt <= 0) return; if (setviewcnt <= 0) return;
setviewcnt--; setviewcnt--;
@ -12328,7 +12328,7 @@ void videoRestoreTarget(void)
if (setviewcnt == 0) if (setviewcnt == 0)
{ {
rendmode = bakrendmode; rendmode = bakrendmode;
invalidatetile(baktile,-1,-1); tileInvalidate(baktile,-1,-1);
} }
#endif #endif
@ -12384,8 +12384,8 @@ void squarerotatetile(int16_t tilenume)
// //
// preparemirror // preparemirror
// //
void preparemirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall, void renderPrepareMirror(int32_t dax, int32_t day, fix16_t daang, int16_t dawall,
int32_t *tposx, int32_t *tposy, fix16_t *tang) 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 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; 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 // completemirror
// //
void completemirror(void) void renderCompleteMirror(void)
{ {
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (videoGetRenderMode() != REND_CLASSIC) if (videoGetRenderMode() != REND_CLASSIC)
@ -13084,7 +13084,7 @@ static void PolymerProcessModels(void)
// //
// setrendermode // setrendermode
// //
int32_t setrendermode(int32_t renderer) int32_t videoSetRenderMode(int32_t renderer)
{ {
UNREFERENCED_PARAMETER(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 else if (videoGetRenderMode() == REND_POLYMER) // going from Polymer to another renderer
{ {
delete_maphack_lights(); engineClearLightsFromMHK();
G_Polymer_UnInit(); G_Polymer_UnInit();
polymer_uninit(); polymer_uninit();
} }
@ -13131,7 +13131,7 @@ int32_t setrendermode(int32_t renderer)
// setrollangle // setrollangle
// //
#ifdef USE_OPENGL #ifdef USE_OPENGL
void setrollangle(int32_t rolla) void renderSetRollAngle(int32_t rolla)
{ {
gtang = (float)rolla * (fPI * (1.f/1024.f)); gtang = (float)rolla * (fPI * (1.f/1024.f));
} }
@ -13152,7 +13152,7 @@ void setrollangle(int32_t rolla)
// bit 7: ignored (67% translucence, using clamping) // bit 7: ignored (67% translucence, using clamping)
// clamping is for sprites, repeating is for walls // 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 #if !defined USE_OPENGL
UNREFERENCED_PARAMETER(tilenume); UNREFERENCED_PARAMETER(tilenume);

View file

@ -142,7 +142,7 @@ void L_DestroyState(L_State *estate)
static void L_OnOutOfMem(void) static void L_OnOutOfMem(void)
{ {
OSD_Printf("Out of memory in Lunatic.\n"); OSD_Printf("Out of memory in Lunatic.\n");
uninitengine(); engineUnInit();
exit(127); exit(127);
} }

View file

@ -17,7 +17,7 @@ int32_t num_usermaphacks;
static int16_t maphacklightcnt=0; static int16_t maphacklightcnt=0;
static int16_t maphacklight[PR_MAXLIGHTS]; static int16_t maphacklight[PR_MAXLIGHTS];
void delete_maphack_lights() void engineClearLightsFromMHK()
{ {
int32_t i; int32_t i;
for (i=0; i<maphacklightcnt; i++) for (i=0; i<maphacklightcnt; i++)
@ -30,13 +30,13 @@ void delete_maphack_lights()
maphacklightcnt = 0; maphacklightcnt = 0;
} }
#else #else
void delete_maphack_lights() {} void engineClearLightsFromMHK() {}
#endif #endif
// //
// loadmaphack // loadmaphack
// //
int32_t loadmaphack(const char *filename) int32_t engineLoadMHK(const char *filename)
{ {
enum enum
{ {
@ -85,7 +85,7 @@ int32_t loadmaphack(const char *filename)
#ifdef POLYMER #ifdef POLYMER
int32_t toomanylights = 0; int32_t toomanylights = 0;
delete_maphack_lights(); engineClearLightsFromMHK();
#endif #endif
if (filename) if (filename)

View file

@ -316,9 +316,9 @@ void palettePostLoadTables(void)
palookup0[i] = palookup0[i+(16<<8)]; palookup0[i] = palookup0[i+(16<<8)];
#endif #endif
blackcol = getclosestcol(0, 0, 0); blackcol = paletteGetClosestColor(0, 0, 0);
whitecol = getclosestcol(255, 255, 255); whitecol = paletteGetClosestColor(255, 255, 255);
redcol = getclosestcol(255, 0, 0); redcol = paletteGetClosestColor(255, 0, 0);
for (size_t i = 0; i<16; i++) for (size_t i = 0; i<16; i++)
{ {
@ -631,7 +631,7 @@ void paletteMakeLookupTable(int32_t palnum, const char *remapbuf, uint8_t r, uin
for (j=0; j<256; j++) for (j=0; j<256; j++)
{ {
const char *ptr = (const char *) &palette[remapbuf[j]*3]; const char *ptr = (const char *) &palette[remapbuf[j]*3];
*ptr2++ = getclosestcol(ptr[0] + mulscale16(r-ptr[0], palscale), *ptr2++ = paletteGetClosestColor(ptr[0] + mulscale16(r-ptr[0], palscale),
ptr[1] + mulscale16(g-ptr[1], palscale), ptr[1] + mulscale16(g-ptr[1], palscale),
ptr[2] + mulscale16(b-ptr[2], palscale)); ptr[2] + mulscale16(b-ptr[2], palscale));
} }

View file

@ -1005,7 +1005,7 @@ void polymer_resetlights(void)
lightcount = 0; lightcount = 0;
if (!loadmaphack(NULL)) if (!engineLoadMHK(NULL))
OSD_Printf("polymer_resetlights: reloaded maphack\n"); OSD_Printf("polymer_resetlights: reloaded maphack\n");
} }
@ -2050,7 +2050,7 @@ static void polymer_displayrooms(const int16_t dacursectnum)
//glEnable(GL_CLIP_PLANE0); //glEnable(GL_CLIP_PLANE0);
if (mirrorlist[i].wallnum >= 0) if (mirrorlist[i].wallnum >= 0)
preparemirror(globalposx, globalposy, qglobalang, renderPrepareMirror(globalposx, globalposy, qglobalang,
mirrorlist[i].wallnum, &gx, &gy, &viewangle); mirrorlist[i].wallnum, &gx, &gy, &viewangle);
gx = globalposx; gx = globalposx;
@ -2120,7 +2120,7 @@ static void polymer_displayrooms(const int16_t dacursectnum)
display_mirror = 0; display_mirror = 0;
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
drawmasks(); renderDrawMasks();
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
} }
return; return;

View file

@ -7321,7 +7321,7 @@ void polymost_fillpolygon(int32_t npoints)
((float *)ry1)[i] = ((float)ry1[i])*(1.0f/4096.f); ((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_ALPHA_TEST);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
pthtyp *pth = our_texcache_fetch(DAMETH_NOMASK | (videoGetRenderMode() == REND_POLYMOST && r_useindexedcolortextures ? PTH_INDEXED : 0)); 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); polymost_usePaletteIndexing(false);
setpolymost2dview(); // disables blending, texturing, and depth testing polymostSet2dView(); // disables blending, texturing, and depth testing
glDisable(GL_ALPHA_TEST); glDisable(GL_ALPHA_TEST);
glDepthMask(GL_FALSE); // disable writing to the z-buffer glDepthMask(GL_FALSE); // disable writing to the z-buffer

View file

@ -52,7 +52,7 @@ static void screencapture_end(char *fn, BFILE** filptr)
# define HICOLOR 0 # define HICOLOR 0
# endif # endif
int screencapture(const char *filename, char inverseit) int videoCaptureScreen(const char *filename, char inverseit)
{ {
char *fn = Xstrdup(filename); char *fn = Xstrdup(filename);
FILE *fp = capturecounter.opennextfile_withext(fn, "png"); FILE *fp = capturecounter.opennextfile_withext(fn, "png");
@ -129,7 +129,7 @@ int screencapture(const char *filename, char inverseit)
return 0; return 0;
} }
int screencapture_tga(const char *filename, char inverseit) int videoCaptureScreenTGA(const char *filename, char inverseit)
{ {
int32_t i; 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 }; 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 };

View file

@ -635,7 +635,7 @@ void tileLoadData(int16_t tilenume, int32_t dasiz, char *buffer)
if (artfil == -1) if (artfil == -1)
{ {
initprintf("Failed opening ART file \"%s\"!\n", fn); initprintf("Failed opening ART file \"%s\"!\n", fn);
uninitengine(); engineUnInit();
Bexit(11); Bexit(11);
} }

View file

@ -497,7 +497,7 @@ int32_t Anim_Play(const char *fn)
i = VM_OnEventWithReturn(EVENT_PRECUTSCENE, g_player[screenpeek].ps->i, screenpeek, i); i = VM_OnEventWithReturn(EVENT_PRECUTSCENE, g_player[screenpeek].ps->i, screenpeek, i);
waloff[TILE_ANIM] = (intptr_t)ANIM_DrawFrame(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())) 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 else
z = divscale16(lrint(320 * ydim * anim->frameaspect1), lrint(tilesiz[TILE_ANIM].y * xdim * anim->frameaspect2)); 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)); 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); rotatesprite_fs(160<<16, 100<<16, z, 512, TILE_ANIM, 0, 0, 2|4|8|64|1024);
videoSetAspect(viewingrange, oyxaspect); renderSetAspect(viewingrange, oyxaspect);
} }
else else
{ {

View file

@ -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); drawrooms(x+offx,y+offy,z+offz,a,h,sprite[floor2].sectnum);
ExtAnalyzeSprites(0,0,0,0); ExtAnalyzeSprites(0,0,0,0);
drawmasks(); renderDrawMasks();
M32_ResetFakeRORTiles(); M32_ResetFakeRORTiles();
if (draw_both) 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 // Now re-draw
drawrooms(x+offx,y+offy,z+offz,a,h,sprite[floor2].sectnum); drawrooms(x+offx,y+offy,z+offz,a,h,sprite[floor2].sectnum);
ExtAnalyzeSprites(0,0,0,0); ExtAnalyzeSprites(0,0,0,0);
drawmasks(); renderDrawMasks();
M32_ResetFakeRORTiles(); M32_ResetFakeRORTiles();
} }
@ -2703,7 +2703,7 @@ static int32_t m32gettile(int32_t idInitialTile)
if (handleevents()) if (handleevents())
quitevent = 0; quitevent = 0;
} }
getmousevalues(&mousedx,&mousedy,&bstatus); mouseGetValues(&mousedx,&mousedy,&bstatus);
iLastTile = tileNum; iLastTile = tileNum;
@ -3271,7 +3271,7 @@ static int32_t OnSelectTile(int32_t tileNum)
keyFlushChars(); keyFlushChars();
setpolymost2dview(); polymostSet2dView();
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (videoGetRenderMode() >= REND_POLYMOST) 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]; char markedcol = editorcolors[14];
setpolymost2dview(); polymostSet2dView();
y1=max(y1, 0); y1=max(y1, 0);
y2=min(y2, ydim-1); 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]; static uint8_t loadedhitile[(MAXTILES+7)>>3];
#ifdef USE_OPENGL #ifdef USE_OPENGL
setpolymost2dview(); polymostSet2dView();
if (videoGetRenderMode() >= REND_POLYMOST) 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 scale = (int32_t)(65536.0/scalediv);
const int32_t oviewingrange=viewingrange, oyxaspect=yxaspect; 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 // +1024: prevents rotatesprite from setting aspect itself
rotatesprite_fs((x1+13)<<16,(y+11)<<16,scale,0, picnum,shade,pal, 2+1024); 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); 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); OSD_ShowDisplay(0);
ExtUnInit(); ExtUnInit();
uninitengine(); engineUnInit();
Bfflush(NULL); Bfflush(NULL);
@ -10031,7 +10031,7 @@ int32_t ExtPostStartupWindow(void)
if (!g_useCwd) if (!g_useCwd)
G_CleanupSearchPaths(); G_CleanupSearchPaths();
if (initengine()) if (engineInit())
{ {
initprintf("There was a problem initializing the engine.\n"); initprintf("There was a problem initializing the engine.\n");
return -1; return -1;
@ -10393,7 +10393,7 @@ void ExtPreCheckKeys(void) // just before drawrooms
if (m32_sideview) 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 += midydim16 + getscreenvdisp(sprite[i].z-pos.z, zoom);
yp1 -= mulscale14(tilesiz[picnum].y<<2, zoom); yp1 -= mulscale14(tilesiz[picnum].y<<2, zoom);
xp1 += halfxdim16; xp1 += halfxdim16;
@ -10409,10 +10409,10 @@ void ExtPreCheckKeys(void) // just before drawrooms
continue; continue;
const int32_t oviewingrange=viewingrange, oyxaspect=yxaspect; 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, rotatesprite(xp1<<16,yp1<<16,zoom<<5,daang,picnum,
shade,sprite[i].pal,flags|1024,0,0,xdim-1,ydim16-1); 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) if (showambiencesounds==1 && sprite[i].sectnum!=cursectnum)
continue; 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) if (m32_sideview)
yp1 += getscreenvdisp(sprite[i].z-pos.z, zoom); 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); 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; drawlinepat = 0xffffffff;
} }
} }
@ -10941,7 +10941,7 @@ void ExtCheckKeys(void)
extern int32_t engine_screenshot; extern int32_t engine_screenshot;
engine_screenshot = 1; engine_screenshot = 1;
#else #else
screencapture("captxxxx.tga", eitherSHIFT); videoCaptureScreen("captxxxx.tga", eitherSHIFT);
silentmessage("Saved screenshot"); silentmessage("Saved screenshot");
#endif #endif
} }

View file

@ -163,19 +163,19 @@ void G_InitMultiPsky(int CLOUDYOCEAN__DYN, int MOONSKY1__DYN, int BIGORBIT1__DYN
// set as tight as possible.) // set as tight as possible.)
// The default sky properties (all others are implicitly zero): // The default sky properties (all others are implicitly zero):
psky_t *sky = E_DefinePsky(DEFAULTPSKY); psky_t *sky = tileSetupSky(DEFAULTPSKY);
sky->lognumtiles = 3; sky->lognumtiles = 3;
sky->horizfrac = 32768; sky->horizfrac = 32768;
// CLOUDYOCEAN // CLOUDYOCEAN
// Aligns with the drawn scene horizon because it has one itself. // Aligns with the drawn scene horizon because it has one itself.
sky = E_DefinePsky(CLOUDYOCEAN__DYN); sky = tileSetupSky(CLOUDYOCEAN__DYN);
sky->lognumtiles = 3; sky->lognumtiles = 3;
sky->horizfrac = 65536; sky->horizfrac = 65536;
// MOONSKY1 // MOONSKY1
// earth mountain mountain sun // earth mountain mountain sun
sky = E_DefinePsky(MOONSKY1__DYN); sky = tileSetupSky(MOONSKY1__DYN);
sky->lognumtiles = 3; sky->lognumtiles = 3;
sky->horizfrac = 32768; sky->horizfrac = 32768;
sky->tileofs[6] = 1; sky->tileofs[6] = 1;
@ -185,7 +185,7 @@ void G_InitMultiPsky(int CLOUDYOCEAN__DYN, int MOONSKY1__DYN, int BIGORBIT1__DYN
// BIGORBIT1 // orbit // BIGORBIT1 // orbit
// earth1 2 3 moon/sun // earth1 2 3 moon/sun
sky = E_DefinePsky(BIGORBIT1__DYN); sky = tileSetupSky(BIGORBIT1__DYN);
sky->lognumtiles = 3; sky->lognumtiles = 3;
sky->horizfrac = 32768; sky->horizfrac = 32768;
sky->tileofs[5] = 1; sky->tileofs[5] = 1;
@ -195,7 +195,7 @@ void G_InitMultiPsky(int CLOUDYOCEAN__DYN, int MOONSKY1__DYN, int BIGORBIT1__DYN
// LA // la city // LA // la city
// earth1 2 3 moon/sun // earth1 2 3 moon/sun
sky = E_DefinePsky(LA__DYN); sky = tileSetupSky(LA__DYN);
sky->lognumtiles = 3; sky->lognumtiles = 3;
sky->horizfrac = 16384 + 1024; sky->horizfrac = 16384 + 1024;
sky->tileofs[0] = 1; sky->tileofs[0] = 1;

View file

@ -203,7 +203,7 @@ void G_HandleSpecialKeys(void)
if (KB_UnBoundKeyPressed(sc_F12)) if (KB_UnBoundKeyPressed(sc_F12))
{ {
KB_ClearKeyDown(sc_F12); KB_ClearKeyDown(sc_F12);
screencapture( videoCaptureScreen(
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
"duke0000.tga" "duke0000.tga"
#else #else
@ -319,7 +319,7 @@ int32_t m32_numdebuglines=0;
static void M32_drawdebug(void) static void M32_drawdebug(void)
{ {
int i, col=getclosestcol(255,255,255); int i, col=paletteGetClosestColor(255,255,255);
int x=4, y=8; int x=4, y=8;
if (m32_numdebuglines>0) if (m32_numdebuglines>0)
@ -521,7 +521,7 @@ static void G_SE40(int32_t smoothratio)
if (videoGetRenderMode() == REND_POLYMER) if (videoGetRenderMode() == REND_POLYMER)
polymer_setanimatesprites(G_DoSpriteAnimations, CAMERA(pos.x), CAMERA(pos.y), fix16_to_int(CAMERA(q16ang)), smoothratio); polymer_setanimatesprites(G_DoSpriteAnimations, CAMERA(pos.x), CAMERA(pos.y), fix16_to_int(CAMERA(q16ang)), smoothratio);
#endif #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); z + renderz, CAMERA(q16ang), CAMERA(q16horiz), sect);
drawing_ror = 1 + level; drawing_ror = 1 + level;
@ -529,7 +529,7 @@ static void G_SE40(int32_t smoothratio)
G_OROR_DupeSprites(sp); G_OROR_DupeSprites(sp);
G_DoSpriteAnimations(CAMERA(pos.x),CAMERA(pos.y),fix16_to_int(CAMERA(q16ang)),smoothratio); G_DoSpriteAnimations(CAMERA(pos.x),CAMERA(pos.y),fix16_to_int(CAMERA(q16ang)),smoothratio);
drawmasks(); renderDrawMasks();
if (level) 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; int32_t tposx, tposy;
fix16_t tang; 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; int32_t j = g_visibility;
g_visibility = (j>>1) + (j>>2); 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; int32_t didmirror;
yax_preparedrawrooms(); 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); yax_drawrooms(G_DoSpriteAnimations, g_mirrorSector[i], didmirror, smoothratio);
} }
#ifdef USE_OPENGL #ifdef USE_OPENGL
else 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 // XXX: Sprites don't get drawn with TROR/Polymost
#endif #endif
display_mirror = 1; display_mirror = 1;
G_DoSpriteAnimations(tposx,tposy,fix16_to_int(tang),smoothratio); G_DoSpriteAnimations(tposx,tposy,fix16_to_int(tang),smoothratio);
display_mirror = 0; display_mirror = 0;
drawmasks(); renderDrawMasks();
completemirror(); //Reverse screen x-wise in this function renderCompleteMirror(); //Reverse screen x-wise in this function
g_visibility = j; g_visibility = j;
} }
@ -680,7 +680,7 @@ static void G_ReadGLFrame(void)
for (x = 0; x < 320; x++) for (x = 0; x < 320; x++)
{ {
const palette_t *pix = &frame[base + mulscale16(x, xf) + (xdim-(ydim*4/3))/2]; 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); polymer_setanimatesprites(G_DoSpriteAnimations, pSprite->x, pSprite->y, fix16_to_int(CAMERA(q16ang)), smoothRatio);
#endif #endif
yax_preparedrawrooms(); 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); yax_drawrooms(G_DoSpriteAnimations, pSprite->sectnum, 0, smoothRatio);
G_DoSpriteAnimations(pSprite->x, pSprite->y, fix16_to_int(CAMERA(q16ang)), smoothRatio); G_DoSpriteAnimations(pSprite->x, pSprite->y, fix16_to_int(CAMERA(q16ang)), smoothRatio);
drawmasks(); renderDrawMasks();
} }
} }
else else
@ -779,13 +779,13 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
))); )));
if (!r_usenewaspect) if (!r_usenewaspect)
videoSetAspect(vr, yxaspect); renderSetAspect(vr, yxaspect);
else else
{ {
viewingRange = vr; viewingRange = vr;
yxAspect = tabledivide32_noinline(65536 * ydim * 8, xdim * 5); yxAspect = tabledivide32_noinline(65536 * ydim * 8, xdim * 5);
videoSetAspect(mulscale16(viewingRange,viewingrange), yxaspect); renderSetAspect(mulscale16(viewingRange,viewingrange), yxaspect);
} }
if (g_screenCapture) 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]); cacheAllocateBlock(&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]);
if (videoGetRenderMode() == REND_CLASSIC) if (videoGetRenderMode() == REND_CLASSIC)
videoSetTarget(TILE_SAVESHOT, 200, 320); renderSetTarget(TILE_SAVESHOT, 200, 320);
} }
else if (screenTilting) else if (screenTilting)
{ {
@ -854,7 +854,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
if (waloff[TILE_TILT] == 0) if (waloff[TILE_TILT] == 0)
cacheAllocateBlock(&waloff[TILE_TILT], maxTiltSize, &walock[TILE_TILT]); cacheAllocateBlock(&waloff[TILE_TILT], maxTiltSize, &walock[TILE_TILT]);
videoSetTarget(TILE_TILT, viewtilexsiz, viewtileysiz); renderSetTarget(TILE_TILT, viewtilexsiz, viewtileysiz);
if ((tang&1023) == 512) 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; vRange = sintable[vRange + 512] * 8 + sintable[vRange] * 5;
// setaspect(i>>1, yxaspect); // setaspect(i>>1, yxaspect);
videoSetAspect(mulscale16(oviewingrange, vRange >> 1), yxaspect); renderSetAspect(mulscale16(oviewingrange, vRange >> 1), yxaspect);
viewingRange = vRange >> 1; viewingRange = vRange >> 1;
yxAspect = tabledivide32_noinline(65536 * ydim * 8, xdim * 5); yxAspect = tabledivide32_noinline(65536 * ydim * 8, xdim * 5);
@ -890,7 +890,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
)) ))
{ {
#ifdef USE_OPENGL #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 #endif
pPlayer->orotscrnang = pPlayer->rotscrnang; pPlayer->orotscrnang = pPlayer->rotscrnang;
} }
@ -1031,7 +1031,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
gotpic[MIRROR>>3] |= (1<<(MIRROR&7)); gotpic[MIRROR>>3] |= (1<<(MIRROR&7));
#else #else
yax_preparedrawrooms(); 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); yax_drawrooms(G_DoSpriteAnimations, CAMERA(sect), 0, smoothRatio);
#ifdef LEGACY_ROR #ifdef LEGACY_ROR
if ((unsigned)ror_sprite < MAXSPRITES && drawing_ror == 1) // viewing from bottom 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 #ifdef LEGACY_ROR
drawing_ror = 0; drawing_ror = 0;
#endif #endif
drawmasks(); renderDrawMasks();
#endif #endif
} }
@ -1049,11 +1049,11 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
{ {
g_screenCapture = 0; g_screenCapture = 0;
invalidatetile(TILE_SAVESHOT, 0, 255); tileInvalidate(TILE_SAVESHOT, 0, 255);
if (videoGetRenderMode() == REND_CLASSIC) if (videoGetRenderMode() == REND_CLASSIC)
{ {
videoRestoreTarget(); renderRestoreTarget();
// walock[TILE_SAVESHOT] = 1; // walock[TILE_SAVESHOT] = 1;
} }
#ifdef USE_OPENGL #ifdef USE_OPENGL
@ -1090,7 +1090,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
} }
else else
{ {
videoRestoreTarget(); renderRestoreTarget();
picanm[TILE_TILT].xofs = picanm[TILE_TILT].yofs = 0; picanm[TILE_TILT].xofs = picanm[TILE_TILT].yofs = 0;
int tiltZoom = (tang&511); int tiltZoom = (tang&511);
@ -1173,7 +1173,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
if (r_usenewaspect) if (r_usenewaspect)
{ {
newaspect_enable = 0; newaspect_enable = 0;
videoSetAspect(viewingRange, yxAspect); renderSetAspect(viewingRange, yxAspect);
} }
VM_OnEvent(EVENT_DISPLAYROOMSEND, g_player[screenpeek].ps->i, screenpeek); VM_OnEvent(EVENT_DISPLAYROOMSEND, g_player[screenpeek].ps->i, screenpeek);
@ -5621,7 +5621,7 @@ void G_Shutdown(void)
S_MusicShutdown(); S_MusicShutdown();
CONTROL_Shutdown(); CONTROL_Shutdown();
KB_Shutdown(); KB_Shutdown();
uninitengine(); engineUnInit();
G_Cleanup(); G_Cleanup();
FreeGroups(); FreeGroups();
OSD_Cleanup(); OSD_Cleanup();
@ -5845,7 +5845,7 @@ static void G_Startup(void)
G_CompileScripts(); G_CompileScripts();
if (initengine()) if (engineInit())
G_FatalEngineError(); G_FatalEngineError();
#ifdef LUNATIC #ifdef LUNATIC
@ -6332,7 +6332,7 @@ int app_main(int argc, char const * const * argv)
} }
#endif #endif
if (preinitengine()) if (enginePreInit())
{ {
wm_msgbox("Build Engine Initialization Error", wm_msgbox("Build Engine Initialization Error",
"There was a problem initializing the Build engine: %s", engineerrstr); "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()) if (quitevent || !startwin_run())
{ {
uninitengine(); engineUnInit();
Bexit(0); Bexit(0);
} }
} }
@ -6454,7 +6454,7 @@ int app_main(int argc, char const * const * argv)
free(m); free(m);
g_defModules.clear(); g_defModules.clear();
if (E_PostInit()) if (enginePostInit())
G_FatalEngineError(); G_FatalEngineError();
G_PostLoadPalette(); G_PostLoadPalette();
@ -6503,7 +6503,7 @@ int app_main(int argc, char const * const * argv)
if (CONTROL_Startup(controltype_keyboardandmouse, &BGetTime, TICRATE)) if (CONTROL_Startup(controltype_keyboardandmouse, &BGetTime, TICRATE))
{ {
ERRprintf("There was an error initializing the CONTROL system.\n"); ERRprintf("There was an error initializing the CONTROL system.\n");
uninitengine(); engineUnInit();
Bexit(5); Bexit(5);
} }
@ -6520,7 +6520,7 @@ int app_main(int argc, char const * const * argv)
} }
#ifdef HAVE_CLIPSHAPE_FEATURE #ifdef HAVE_CLIPSHAPE_FEATURE
int const clipMapError = clipmapinfo_load(); int const clipMapError = engineLoadClipMaps();
if (clipMapError > 0) if (clipMapError > 0)
initprintf("There was an error loading the sprite clipping map (status %d).\n", clipMapError); initprintf("There was an error loading the sprite clipping map (status %d).\n", clipMapError);

View file

@ -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); polymer_setanimatesprites(G_DoSpriteAnimations, vec.x, vec.y, fix16_to_int(a), smoothratio);
#endif #endif
yax_preparedrawrooms(); 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); yax_drawrooms(G_DoSpriteAnimations, sect, 0, smoothratio);
display_mirror = 2; display_mirror = 2;
G_DoSpriteAnimations(vec.x, vec.y, fix16_to_int(a), smoothratio); G_DoSpriteAnimations(vec.x, vec.y, fix16_to_int(a), smoothratio);
display_mirror = 0; display_mirror = 0;
drawmasks(); renderDrawMasks();
G_RestoreInterpolations(); G_RestoreInterpolations();
G_UpdateScreenArea(); G_UpdateScreenArea();
} }
@ -1975,7 +1975,7 @@ skip_check:
insptr++; insptr++;
{ {
int const xRange = Gv_GetVarX(*insptr++); int const xRange = Gv_GetVarX(*insptr++);
videoSetAspect(xRange, Gv_GetVarX(*insptr++)); renderSetAspect(xRange, Gv_GetVarX(*insptr++));
break; break;
} }

View file

@ -2277,7 +2277,7 @@ badindex:
insptr++; insptr++;
{ {
int32_t r = Gv_GetVarX(*insptr++), g = Gv_GetVarX(*insptr++), b = Gv_GetVarX(*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; continue;
} }
@ -2899,7 +2899,7 @@ dodefault:
if (daxrange > (1<<20)) daxrange = (1<<20); if (daxrange > (1<<20)) daxrange = (1<<20);
if (dayxaspect < (1<<12)) dayxaspect = (1<<12); if (dayxaspect < (1<<12)) dayxaspect = (1<<12);
if (dayxaspect > (1<<20)) dayxaspect = (1<<20); if (dayxaspect > (1<<20)) dayxaspect = (1<<20);
videoSetAspect(daxrange, dayxaspect); renderSetAspect(daxrange, dayxaspect);
continue; continue;
} }
@ -3021,8 +3021,8 @@ dodefault:
if (tw==CON_DRAWLINE16B || tw==CON_DRAWLINE16Z) if (tw==CON_DRAWLINE16B || tw==CON_DRAWLINE16Z)
{ {
screencoords(&x1,&y1, x1-pos.x,y1-pos.y, zoom); editorGet2dScreenCoordinates(&x1,&y1, x1-pos.x,y1-pos.y, zoom);
screencoords(&x2,&y2, x2-pos.x,y2-pos.y, zoom); editorGet2dScreenCoordinates(&x2,&y2, x2-pos.x,y2-pos.y, zoom);
if (tw==CON_DRAWLINE16Z && m32_sideview) if (tw==CON_DRAWLINE16Z && m32_sideview)
{ {
@ -3035,7 +3035,7 @@ dodefault:
} }
drawlinepat = m32_drawlinepat; 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; drawlinepat = odrawlinepat;
continue; continue;
} }
@ -3053,7 +3053,7 @@ dodefault:
if (tw==CON_DRAWCIRCLE16B || tw==CON_DRAWCIRCLE16Z) 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) if (m32_sideview)
y1 += getscreenvdisp(z1-pos.z, zoom); y1 += getscreenvdisp(z1-pos.z, zoom);
r = mulscale14(r,zoom); r = mulscale14(r,zoom);
@ -3063,7 +3063,7 @@ dodefault:
} }
drawlinepat = m32_drawlinepat; 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; drawlinepat = odrawlinepat;
continue; continue;
} }

View file

@ -3045,7 +3045,7 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
{ {
if (videoSetGameMode(p.flags, p.xdim, p.ydim, p.bppmax) < 0) if (videoSetGameMode(p.flags, p.xdim, p.ydim, p.bppmax) < 0)
{ {
setrendermode(prend); videoSetRenderMode(prend);
G_GameExit("Failed restoring old video mode."); G_GameExit("Failed restoring old video mode.");
} }
else else
@ -3058,7 +3058,7 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
g_restorePalette = -1; g_restorePalette = -1;
G_UpdateScreenArea(); G_UpdateScreenArea();
setrendermode(nrend); videoSetRenderMode(nrend);
vsync = videoSetVsync(nvsync); vsync = videoSetVsync(nvsync);
ud.config.ScreenMode = fullscreen; ud.config.ScreenMode = fullscreen;
ud.config.ScreenWidth = xdim; ud.config.ScreenWidth = xdim;
@ -6964,7 +6964,7 @@ void M_DisplayMenus(void)
int32_t alpha; int32_t alpha;
if (KXDWN) if (KXDWN)
{ {
videoSetAspect(viewingrange, 65536); renderSetAspect(viewingrange, 65536);
cursorpos.x = scale(cursorpos.x - (320<<15), ydim << 2, xdim * 3) + (320<<15); 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); cursorpos.y = scale(cursorpos.y - (200<<15), (ydim << 2) * 6, (xdim * 3) * 5) + (200<<15);
z = scale(32768, ydim << 2, xdim * 3); 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); rotatesprite_fs_alpha(cursorpos.x, cursorpos.y, z, 0, a, 0, p, o, alpha);
if (KXDWN) if (KXDWN)
videoSetAspect(viewingrange, oyxaspect); renderSetAspect(viewingrange, oyxaspect);
} }
} }
else else

View file

@ -1229,8 +1229,8 @@ static int32_t osdcmd_screenshot(osdfuncparm_t const * const parm)
#endif #endif
if (parm->numparms == 1 && !Bstrcasecmp(parm->parms[0], "tga")) if (parm->numparms == 1 && !Bstrcasecmp(parm->parms[0], "tga"))
screencapture_tga(fn, 0); videoCaptureScreenTGA(fn, 0);
else screencapture(fn, 0); else videoCaptureScreen(fn, 0);
return OSDCMD_OK; return OSDCMD_OK;
} }

View file

@ -149,7 +149,7 @@ void GAME_clearbackground(int32_t numcols, int32_t numrows)
polymost_setFogEnabled(false); polymost_setFogEnabled(false);
polymost_useColorOnly(true); polymost_useColorOnly(true);
setpolymost2dview(); polymostSet2dView();
glColor4f(0.f, 0.f, 0.f, 0.67f); glColor4f(0.f, 0.f, 0.f, 0.67f);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glRecti(0, 0, xdim, i8n8+OSDCHAR_HEIGHT); glRecti(0, 0, xdim, i8n8+OSDCHAR_HEIGHT);

View file

@ -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) static int G_TryMapHack(const char *mhkfile)
{ {
int32_t failure = loadmaphack(mhkfile); int32_t failure = engineLoadMHK(mhkfile);
if (!failure) if (!failure)
initprintf("Loaded map hack file \"%s\"\n", mhkfile); initprintf("Loaded map hack file \"%s\"\n", mhkfile);
@ -1852,7 +1852,7 @@ int G_EnterLevel(int gameMode)
if (!VOLUMEONE && Menu_HaveUserMap()) 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); OSD_Printf(OSD_ERROR "Map \"%s\" not found or invalid map version!\n", boardfilename);
return 1; return 1;
@ -1861,7 +1861,7 @@ int G_EnterLevel(int gameMode)
G_LoadMapHack(levelName, boardfilename); G_LoadMapHack(levelName, boardfilename);
G_SetupFilenameBasedMusic(levelName, boardfilename, ud.m_level_number); 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); OSD_Printf(OSD_ERROR "Map \"%s\" not found or invalid map version!\n", g_mapInfo[mii].filename);
return 1; return 1;

View file

@ -309,7 +309,7 @@ int32_t G_LoadSaveHeaderNew(char const *fn, savehead_t *saveh)
{ {
Bmemset((char *)waloff[TILE_LOADSHOT], 0, 320*200); Bmemset((char *)waloff[TILE_LOADSHOT], 0, 320*200);
} }
invalidatetile(TILE_LOADSHOT, 0, 255); tileInvalidate(TILE_LOADSHOT, 0, 255);
kclose(fil); kclose(fil);
return 0; return 0;
@ -392,7 +392,7 @@ int32_t G_LoadPlayer(savebrief_t & sv)
{ {
artSetupMapArt(currentboardfilename); artSetupMapArt(currentboardfilename);
append_ext_UNSAFE(currentboardfilename, ".mhk"); append_ext_UNSAFE(currentboardfilename, ".mhk");
loadmaphack(currentboardfilename); engineLoadMHK(currentboardfilename);
} }
Bmemcpy(currentboardfilename, boardfilename, BMAX_PATH); Bmemcpy(currentboardfilename, boardfilename, BMAX_PATH);

View file

@ -158,8 +158,8 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b)
if (ii <= 0) return; if (ii <= 0) return;
if (videoGetRenderMode() == REND_CLASSIC) if (videoGetRenderMode() == REND_CLASSIC)
i = getclosestcol(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b); i = paletteGetClosestColor(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 else i = paletteGetClosestColor(255, 255, 255); // use white in GL so we can tint it to the right color
do do
{ {
@ -178,7 +178,7 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b)
crosshairtint.b = CrosshairColors.b; crosshairtint.b = CrosshairColors.b;
crosshairtint.f = HICTINT_USEONART | HICTINT_GRAYSCALE; crosshairtint.f = HICTINT_USEONART | HICTINT_GRAYSCALE;
#endif #endif
invalidatetile(CROSSHAIR, -1, -1); tileInvalidate(CROSSHAIR, -1, -1);
} }
#define SCORESHEETOFFSET -20 #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; 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; xvect = sintable[(-cang)&2047] * czoom;
yvect = sintable[(1536-cang)&2047] * czoom; yvect = sintable[(1536-cang)&2047] * czoom;
@ -1068,7 +1068,7 @@ void G_DisplayRest(int32_t smoothratio)
if (ud.overhead_on == 2) if (ud.overhead_on == 2)
{ {
videoClearViewableArea(0L); videoClearViewableArea(0L);
drawmapview(cposx, cposy, pp->zoom, cang); renderDrawMapView(cposx, cposy, pp->zoom, cang);
} }
G_DrawOverheadMap(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_scale = scale(crosshair_scale, ydim << 2, xdim * 3) >> 1;
crosshair_pal = 0; crosshair_pal = 0;
crosshair_o |= 1024; crosshair_o |= 1024;
videoSetAspect(viewingrange, 65536); renderSetAspect(viewingrange, 65536);
} }
rotatesprite_win(crosshairpos.x, crosshairpos.y, crosshair_scale, 0, a, 0, crosshair_pal, crosshair_o); rotatesprite_win(crosshairpos.x, crosshairpos.y, crosshair_scale, 0, a, 0, crosshair_pal, crosshair_o);
if (KXDWN) 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_scale = scale(pointer_scale, ydim << 2, xdim * 3) >> 1;
pointer_pal = 0; pointer_pal = 0;
pointer_o |= 1024; pointer_o |= 1024;
videoSetAspect(viewingrange, 65536); renderSetAspect(viewingrange, 65536);
} }
rotatesprite_win(pointerpos.x, pointerpos.y, pointer_scale, 0, a, 0, pointer_pal, pointer_o); rotatesprite_win(pointerpos.x, pointerpos.y, pointer_scale, 0, a, 0, pointer_pal, pointer_o);
if (KXDWN) if (KXDWN)
videoSetAspect(viewingrange, oyxaspect); renderSetAspect(viewingrange, oyxaspect);
} }
} }
#endif #endif
@ -1233,7 +1233,7 @@ void G_DisplayRest(int32_t smoothratio)
{ {
int32_t vr=viewingrange, asp=yxaspect; int32_t vr=viewingrange, asp=yxaspect;
VM_OnEvent_(EVENT_DISPLAYREST, g_player[screenpeek].ps->i, screenpeek); 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) if (ud.pause_on==1 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)

View file

@ -380,7 +380,7 @@ static void G_SetupCamTile(int spriteNum, int tileNum, int smoothRatio)
int const saveMirror = display_mirror; int const saveMirror = display_mirror;
//if (waloff[wn] == 0) loadtile(wn); //if (waloff[wn] == 0) loadtile(wn);
videoSetTarget(tileNum, tilesiz[tileNum].y, tilesiz[tileNum].x); renderSetTarget(tileNum, tilesiz[tileNum].y, tilesiz[tileNum].x);
yax_preparedrawrooms(); yax_preparedrawrooms();
drawrooms(camera.x, camera.y, camera.z, SA(spriteNum), 100 + sprite[spriteNum].shade, SECT(spriteNum)); 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; display_mirror = 3;
G_DoSpriteAnimations(camera.x, camera.y, SA(spriteNum), smoothRatio); G_DoSpriteAnimations(camera.x, camera.y, SA(spriteNum), smoothRatio);
display_mirror = saveMirror; display_mirror = saveMirror;
drawmasks(); renderDrawMasks();
videoRestoreTarget(); renderRestoreTarget();
squarerotatetile(tileNum); squarerotatetile(tileNum);
invalidatetile(tileNum, -1, 255); tileInvalidate(tileNum, -1, 255);
} }
void G_AnimateCamSprite(int smoothRatio) void G_AnimateCamSprite(int smoothRatio)