mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Mapster32 maintenance pack #1
The bulk of this commit is "code rape"--or rather, caressing, rewritten for readability. Actual changes/fixes: - fixed "walking" in 2d mode - fixed DELETE key in OSD in SDL build - main loop in general (timeout for event wait after 200 ms so that highlights blink) - access to some pr_override* variables in m32script (suggested by Roma Loom) - API cleanup (added statics and consts here and there) git-svn-id: https://svn.eduke32.com/eduke32@1644 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
21192dfb48
commit
8077dcd633
21 changed files with 3469 additions and 4512 deletions
|
@ -12,6 +12,10 @@ gamevar m 0 1
|
||||||
gamevar p 0 1
|
gamevar p 0 1
|
||||||
gamevar q 0 1
|
gamevar q 0 1
|
||||||
|
|
||||||
|
gamevar gi 0 0
|
||||||
|
gamevar gj 0 0
|
||||||
|
gamevar gk 0 0
|
||||||
|
|
||||||
gamevar tmp 0 0
|
gamevar tmp 0 0
|
||||||
|
|
||||||
gamevar davr 65536 0
|
gamevar davr 65536 0
|
||||||
|
@ -50,6 +54,17 @@ definequote 17 PICNUM:
|
||||||
|
|
||||||
definequote 18 NUMBER KEY: %d (SCANCODE: %d)
|
definequote 18 NUMBER KEY: %d (SCANCODE: %d)
|
||||||
|
|
||||||
|
// Corruption checker
|
||||||
|
definequote 19 PANIC!!! SECTOR OR WALL LIMIT EXCEEDED!!!
|
||||||
|
definequote 20 SECTOR[%d].WALLPTR=%d out of range: numwalls=%d!!!
|
||||||
|
definequote 21 SECTOR[%d].WALLPTR=%d inconsistent, expected %d!!!
|
||||||
|
definequote 22 SECTOR[%d]: wallptr+wallnum=%d out of range: numwalls=%d!!!
|
||||||
|
definequote 23 WALL[%d].POINT2=%d out of range: sector[%d].wallptr=%d, endwall=%d!!!
|
||||||
|
definequote 24 WALL[%d].NEXTWALL=%d out of range: numwalls=%d!!!
|
||||||
|
definequote 25 WALL[%d].NEXTSECTOR=%d out of range: numsectors=%d!!!
|
||||||
|
|
||||||
|
definequote 26 FLOAT ACCESS TEST
|
||||||
|
|
||||||
gamearray ar 128
|
gamearray ar 128
|
||||||
gamearray parm 8
|
gamearray parm 8
|
||||||
|
|
||||||
|
@ -78,6 +93,16 @@ defstate tests
|
||||||
ife i 5 break
|
ife i 5 break
|
||||||
}
|
}
|
||||||
ife i 5 quote 0 else quote 1
|
ife i 5 quote 0 else quote 1
|
||||||
|
|
||||||
|
quote 26
|
||||||
|
set tmp pr_parallaxscale
|
||||||
|
|
||||||
|
set gi tmp set gj tmp set gk tmp
|
||||||
|
al gi al gj al gk
|
||||||
|
ftoi gi 20 ftoi gj 200 ftoi gk 2000
|
||||||
|
al gi al gj al gk
|
||||||
|
mul gk 2
|
||||||
|
itof gk 2000
|
||||||
ends
|
ends
|
||||||
|
|
||||||
// prints out maphack light definitions based on SE lights in map
|
// prints out maphack light definitions based on SE lights in map
|
||||||
|
@ -112,10 +137,30 @@ ends
|
||||||
|
|
||||||
// convenient polymer SE light manipulation with keypad keys
|
// convenient polymer SE light manipulation with keypad keys
|
||||||
defstate fiddlewithlights
|
defstate fiddlewithlights
|
||||||
|
ifn searchstat 0 ifn searchstat 4 nullop
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// polymer override parallaxscale
|
||||||
|
set j 0
|
||||||
|
ifhitkey KEY_KP8 set j 1
|
||||||
|
ifhitkey KEY_KP5 set j -1
|
||||||
|
ifeithershift nullop else mul j 10
|
||||||
|
|
||||||
|
ifn j 0
|
||||||
|
{
|
||||||
|
set k pr_parallaxscale // also available: ~bias, specularfactor, ~power
|
||||||
|
ftoi k 2000000 // must convert to scaled integer
|
||||||
|
add k j
|
||||||
|
itof k 2000000 // convert back
|
||||||
|
set pr_parallaxscale k
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
ife searchstat 3 ife sprite[searchwall].picnum SECTOREFFECTOR
|
ife searchstat 3 ife sprite[searchwall].picnum SECTOREFFECTOR
|
||||||
ifge sprite[searchwall].lotag 49 ifle sprite[searchwall].lotag 50
|
ifge sprite[searchwall].lotag 49 ifle sprite[searchwall].lotag 50
|
||||||
{
|
{
|
||||||
set i searchwall, seti i
|
set i searchwall, seti i // set current sprite = targeted sprite
|
||||||
|
|
||||||
// horiz
|
// horiz
|
||||||
ifeithershift set j 1 else set j 10
|
ifeithershift set j 1 else set j 10
|
||||||
|
@ -531,13 +576,6 @@ defstate jumptosec // (tmp)
|
||||||
ends
|
ends
|
||||||
|
|
||||||
// Map corruption checker
|
// Map corruption checker
|
||||||
definequote 19 PANIC!!! SECTOR OR WALL LIMIT EXCEEDED!!!
|
|
||||||
definequote 20 SECTOR[%d].WALLPTR=%d out of range: numwalls=%d!!!
|
|
||||||
definequote 21 SECTOR[%d].WALLPTR=%d inconsistent, expected %d!!!
|
|
||||||
definequote 22 SECTOR[%d]: wallptr+wallnum=%d out of range: numwalls=%d!!!
|
|
||||||
definequote 23 WALL[%d].POINT2=%d out of range: sector[%d].wallptr=%d, endwall=%d!!!
|
|
||||||
definequote 24 WALL[%d].NEXTWALL=%d out of range: numwalls=%d!!!
|
|
||||||
definequote 25 WALL[%d].NEXTSECTOR=%d out of range: numsectors=%d!!!
|
|
||||||
|
|
||||||
gamevar ewall 0 0
|
gamevar ewall 0 0
|
||||||
gamevar endwall 0 0
|
gamevar endwall 0 0
|
||||||
|
|
|
@ -98,6 +98,7 @@ void debugprintf(const char *,...);
|
||||||
int32_t handleevents(void);
|
int32_t handleevents(void);
|
||||||
extern inline void idle(void);
|
extern inline void idle(void);
|
||||||
extern inline void idle_waitevent(void);
|
extern inline void idle_waitevent(void);
|
||||||
|
extern inline void idle_waitevent_timeout(int32_t timeout);
|
||||||
|
|
||||||
typedef void (*KeyPressCallback)(int32_t,int32_t);
|
typedef void (*KeyPressCallback)(int32_t,int32_t);
|
||||||
typedef void (*MousePressCallback)(int32_t,int32_t);
|
typedef void (*MousePressCallback)(int32_t,int32_t);
|
||||||
|
|
|
@ -414,6 +414,10 @@ OTHER VARIABLES:
|
||||||
you call the loadboard function.
|
you call the loadboard function.
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int32_t x, y;
|
||||||
|
} vec2_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t x, y, z;
|
int32_t x, y, z;
|
||||||
} vec3_t;
|
} vec3_t;
|
||||||
|
@ -463,8 +467,8 @@ void clearallviews(int32_t dacol);
|
||||||
void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang);
|
void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang);
|
||||||
void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, char dapalnum, char dastat, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2);
|
void rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, char dapalnum, char dastat, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2);
|
||||||
void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col);
|
void drawline256(int32_t x1, int32_t y1, int32_t x2, int32_t y2, char col);
|
||||||
int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char *name, char fontsize);
|
int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize);
|
||||||
void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char *name, char fontsize);
|
void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize);
|
||||||
|
|
||||||
int32_t clipmove(vec3_t *vect, int16_t *sectnum, int32_t xvect, int32_t yvect, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype);
|
int32_t clipmove(vec3_t *vect, int16_t *sectnum, int32_t xvect, int32_t yvect, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype);
|
||||||
int32_t clipinsidebox(int32_t x, int32_t y, int16_t wallnum, int32_t walldist);
|
int32_t clipinsidebox(int32_t x, int32_t y, int16_t wallnum, int32_t walldist);
|
||||||
|
@ -494,13 +498,13 @@ EXTERN int16_t radarang[1280];
|
||||||
static inline int32_t getangle(int32_t xvect, int32_t yvect)
|
static inline int32_t getangle(int32_t xvect, int32_t yvect)
|
||||||
{
|
{
|
||||||
if ((xvect|yvect) == 0) return(0);
|
if ((xvect|yvect) == 0) return(0);
|
||||||
if (xvect == 0) return(512+((yvect<0)<<10));
|
if (xvect == 0) return 512+((yvect<0)<<10);
|
||||||
if (yvect == 0) return(((xvect<0)<<10));
|
if (yvect == 0) return ((xvect<0)<<10);
|
||||||
if (xvect == yvect) return(256+((xvect<0)<<10));
|
if (xvect == yvect) return 256+((xvect<0)<<10);
|
||||||
if (xvect == -yvect) return(768+((xvect>0)<<10));
|
if (xvect == -yvect) return 768+((xvect>0)<<10);
|
||||||
if (klabs(xvect) > klabs(yvect))
|
if (klabs(xvect) > klabs(yvect))
|
||||||
return(((radarang[640+scale(160,yvect,xvect)]>>6)+((xvect<0)<<10))&2047);
|
return ((radarang[640+scale(160,yvect,xvect)]>>6)+((xvect<0)<<10))&2047;
|
||||||
return(((radarang[640-scale(160,xvect,yvect)]>>6)+512+((yvect<0)<<10))&2047);
|
return ((radarang[640-scale(160,xvect,yvect)]>>6)+512+((yvect<0)<<10))&2047;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rotatepoint(int32_t xpivot, int32_t ypivot, int32_t x, int32_t y, int16_t daang, int32_t *x2, int32_t *y2);
|
void rotatepoint(int32_t xpivot, int32_t ypivot, int32_t x, int32_t y, int16_t daang, int32_t *x2, int32_t *y2);
|
||||||
|
|
|
@ -90,11 +90,14 @@ int32_t writesetup(const char *fn); // from config.c
|
||||||
void editinput(void);
|
void editinput(void);
|
||||||
void clearmidstatbar16(void);
|
void clearmidstatbar16(void);
|
||||||
|
|
||||||
int32_t _getnumber256(char *namestart, int32_t num, int32_t maxnumber, char sign, void *(func)(int32_t));
|
int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, char sign, void *(func)(int32_t));
|
||||||
#define getnumber256(namestart, num, maxnumber, sign) _getnumber256(namestart, num, maxnumber, sign, NULL)
|
#define getnumber256(namestart, num, maxnumber, sign) _getnumber256(namestart, num, maxnumber, sign, NULL)
|
||||||
int32_t _getnumber16(char *namestart, int32_t num, int32_t maxnumber, char sign, void *(func)(int32_t));
|
int32_t _getnumber16(const char *namestart, int32_t num, int32_t maxnumber, char sign, void *(func)(int32_t));
|
||||||
#define getnumber16(namestart, num, maxnumber, sign) _getnumber16(namestart, num, maxnumber, sign, NULL)
|
#define getnumber16(namestart, num, maxnumber, sign) _getnumber16(namestart, num, maxnumber, sign, NULL)
|
||||||
void printmessage256(int32_t x, int32_t y, char *name);
|
void printmessage256(int32_t x, int32_t y, const char *name);
|
||||||
|
|
||||||
|
// like snprintf, but pads the output buffer with 'fill' at the end
|
||||||
|
int32_t snfillprintf(char *outbuf, size_t bufsiz, int32_t fill, const char *fmt, ...);
|
||||||
void _printmessage16(const char *fmt, ...);
|
void _printmessage16(const char *fmt, ...);
|
||||||
|
|
||||||
extern int32_t lastpm16time;
|
extern int32_t lastpm16time;
|
||||||
|
@ -115,6 +118,18 @@ int32_t getpointhighlight(int32_t xplc, int32_t yplc, int32_t point);
|
||||||
|
|
||||||
void test_map(int32_t mode);
|
void test_map(int32_t mode);
|
||||||
|
|
||||||
|
|
||||||
|
#define NEXTWALL(i) (wall[wall[i].nextwall])
|
||||||
|
#define POINT2(i) (wall[wall[i].point2])
|
||||||
|
#define SPRITESEC(j) (sector[sprite[j].sectnum])
|
||||||
|
|
||||||
|
static inline int32_t wallength(int16_t i)
|
||||||
|
{
|
||||||
|
int32_t dax = POINT2(i).x - wall[i].x;
|
||||||
|
int32_t day = POINT2(i).y - wall[i].y;
|
||||||
|
return ksqrt(dax*dax + day*day);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -118,7 +118,7 @@ enum GamevarFlags_t {
|
||||||
GAMEVAR_SYSTEM = 0x00000800, // cannot change mode flags...(only default value)
|
GAMEVAR_SYSTEM = 0x00000800, // cannot change mode flags...(only default value)
|
||||||
GAMEVAR_READONLY = 0x00001000, // values are read-only (no setvar allowed)
|
GAMEVAR_READONLY = 0x00001000, // values are read-only (no setvar allowed)
|
||||||
GAMEVAR_INTPTR = 0x00002000, // plValues is a pointer to an int32_t
|
GAMEVAR_INTPTR = 0x00002000, // plValues is a pointer to an int32_t
|
||||||
|
GAMEVAR_FLOATPTR = 0x00004000, // plValues is a pointer to a float
|
||||||
GAMEVAR_SHORTPTR = 0x00008000, // plValues is a pointer to a short
|
GAMEVAR_SHORTPTR = 0x00008000, // plValues is a pointer to a short
|
||||||
GAMEVAR_CHARPTR = 0x00010000, // plValues is a pointer to a char
|
GAMEVAR_CHARPTR = 0x00010000, // plValues is a pointer to a char
|
||||||
// GAMEVAR_NORESET = 0x00020000, // var values are not reset when restoring map state
|
// GAMEVAR_NORESET = 0x00020000, // var values are not reset when restoring map state
|
||||||
|
|
|
@ -80,6 +80,7 @@ char *OSD_GetTextPtr(void);
|
||||||
char *OSD_GetFmtPtr(void);
|
char *OSD_GetFmtPtr(void);
|
||||||
|
|
||||||
int32_t OSD_GetCols(void);
|
int32_t OSD_GetCols(void);
|
||||||
|
int32_t OSD_IsMoving(void);
|
||||||
|
|
||||||
// initializes things
|
// initializes things
|
||||||
void OSD_Init(void);
|
void OSD_Init(void);
|
||||||
|
|
|
@ -49,7 +49,7 @@ void polymost_glreset(void);
|
||||||
void gltexinvalidate(int32_t dapicnum, int32_t dapalnum, int32_t dameth);
|
void gltexinvalidate(int32_t dapicnum, int32_t dapalnum, int32_t dameth);
|
||||||
void gltexinvalidateall(void);
|
void gltexinvalidateall(void);
|
||||||
void gltexinvalidate8(void);
|
void gltexinvalidate8(void);
|
||||||
int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char *name, char fontsize);
|
int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize);
|
||||||
|
|
||||||
extern float curpolygonoffset;
|
extern float curpolygonoffset;
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -59,7 +59,7 @@ extern int16_t brightness;
|
||||||
extern int32_t vsync;
|
extern int32_t vsync;
|
||||||
extern char game_executable[BMAX_PATH];
|
extern char game_executable[BMAX_PATH];
|
||||||
extern int32_t fullscreen;
|
extern int32_t fullscreen;
|
||||||
extern char option[8];
|
extern char option[9];
|
||||||
extern char keys[NUMBUILDKEYS];
|
extern char keys[NUMBUILDKEYS];
|
||||||
extern char remap[256];
|
extern char remap[256];
|
||||||
extern int32_t remapinit;
|
extern int32_t remapinit;
|
||||||
|
|
|
@ -11468,7 +11468,7 @@ void draw2dscreen(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int
|
||||||
//
|
//
|
||||||
// printext16
|
// printext16
|
||||||
//
|
//
|
||||||
int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char *name, char fontsize)
|
int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize)
|
||||||
{
|
{
|
||||||
int32_t stx, i, x, y, charxsiz, ocol = col, obackcol = backcol;
|
int32_t stx, i, x, y, charxsiz, ocol = col, obackcol = backcol;
|
||||||
char *fontptr, *letptr, *ptr;
|
char *fontptr, *letptr, *ptr;
|
||||||
|
@ -11573,7 +11573,7 @@ int32_t printext16(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, cha
|
||||||
//
|
//
|
||||||
// printext256
|
// printext256
|
||||||
//
|
//
|
||||||
void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char *name, char fontsize)
|
void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize)
|
||||||
{
|
{
|
||||||
int32_t stx, i, x, y, charxsiz;
|
int32_t stx, i, x, y, charxsiz;
|
||||||
char *fontptr, *letptr, *ptr;
|
char *fontptr, *letptr, *ptr;
|
||||||
|
|
|
@ -253,6 +253,11 @@ int32_t OSD_GetCols(void)
|
||||||
return osdcols;
|
return osdcols;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t OSD_IsMoving(void)
|
||||||
|
{
|
||||||
|
return (osdrowscur!=-1 && osdrowscur!=osdrows);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t OSD_GetTextMode(void)
|
int32_t OSD_GetTextMode(void)
|
||||||
{
|
{
|
||||||
return osdtextmode;
|
return osdtextmode;
|
||||||
|
@ -884,7 +889,7 @@ int32_t OSD_HandleChar(char ch)
|
||||||
if (osdeditcursor < osdeditlen) osdeditcursor++;
|
if (osdeditcursor < osdeditlen) osdeditcursor++;
|
||||||
return 0;
|
return 0;
|
||||||
case 8:
|
case 8:
|
||||||
case 127: // control h, backspace
|
// case 127: // control h, backspace
|
||||||
if (!osdeditcursor || !osdeditlen) return 0;
|
if (!osdeditcursor || !osdeditlen) return 0;
|
||||||
if ((osdflags & OSD_OVERTYPE) == 0)
|
if ((osdflags & OSD_OVERTYPE) == 0)
|
||||||
{
|
{
|
||||||
|
@ -894,6 +899,7 @@ int32_t OSD_HandleChar(char ch)
|
||||||
}
|
}
|
||||||
osdeditcursor--;
|
osdeditcursor--;
|
||||||
if (osdeditcursor<osdeditwinstart) osdeditwinstart--,osdeditwinend--;
|
if (osdeditcursor<osdeditwinstart) osdeditwinstart--,osdeditwinend--;
|
||||||
|
case 127: // handled in OSD_HandleScanCode (delete)
|
||||||
return 0;
|
return 0;
|
||||||
case 9: // tab
|
case 9: // tab
|
||||||
{
|
{
|
||||||
|
|
|
@ -5705,7 +5705,7 @@ int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, i
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, char *name, char fontsize)
|
int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const char *name, char fontsize)
|
||||||
{
|
{
|
||||||
#ifndef USE_OPENGL
|
#ifndef USE_OPENGL
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -16,6 +16,11 @@
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
#include "osd.h"
|
#include "osd.h"
|
||||||
|
|
||||||
|
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2
|
||||||
|
// for SDL_WaitEventTimeout defined below
|
||||||
|
#include <SDL/SDL_events.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
# include "glbuild.h"
|
# include "glbuild.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -32,6 +37,10 @@ int32_t startwin_idle(void *s) { s=s; return 0; }
|
||||||
int32_t startwin_settitle(const char *s) { s=s; return 0; }
|
int32_t startwin_settitle(const char *s) { s=s; return 0; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// These can be useful for debugging sometimes...
|
||||||
|
//#define SDL_WM_GrabInput(x) SDL_WM_GrabInput(SDL_GRAB_OFF)
|
||||||
|
//#define SDL_ShowCursor(x) SDL_ShowCursor(SDL_ENABLE)
|
||||||
|
|
||||||
#define SURFACE_FLAGS (SDL_SWSURFACE|SDL_HWPALETTE|SDL_HWACCEL)
|
#define SURFACE_FLAGS (SDL_SWSURFACE|SDL_HWPALETTE|SDL_HWACCEL)
|
||||||
|
|
||||||
// undefine to restrict windowed resolutions to conventional sizes
|
// undefine to restrict windowed resolutions to conventional sizes
|
||||||
|
@ -232,6 +241,7 @@ static void attach_debugger_here(void){}
|
||||||
|
|
||||||
static void sighandler(int signum)
|
static void sighandler(int signum)
|
||||||
{
|
{
|
||||||
|
UNREFERENCED_PARAMETER(signum);
|
||||||
// if (signum==SIGSEGV)
|
// if (signum==SIGSEGV)
|
||||||
{
|
{
|
||||||
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||||
|
@ -607,6 +617,9 @@ void grabmouse(char a)
|
||||||
void readmousexy(int32_t *x, int32_t *y)
|
void readmousexy(int32_t *x, int32_t *y)
|
||||||
{
|
{
|
||||||
if (!mouseacquired || !appactive || !moustat) { *x = *y = 0; return; }
|
if (!mouseacquired || !appactive || !moustat) { *x = *y = 0; return; }
|
||||||
|
|
||||||
|
// if (mousex|mousey)printf("r:%d,%d\n",mousex,mousey); ///
|
||||||
|
|
||||||
*x = mousex;
|
*x = mousex;
|
||||||
*y = mousey;
|
*y = mousey;
|
||||||
mousex = mousey = 0;
|
mousex = mousey = 0;
|
||||||
|
@ -1566,6 +1579,8 @@ int32_t handleevents(void)
|
||||||
|
|
||||||
if (code != scantoasc[OSD_OSDKey()] && ((keyasciififoend+1)&(KEYFIFOSIZ-1)) != keyasciififoplc)
|
if (code != scantoasc[OSD_OSDKey()] && ((keyasciififoend+1)&(KEYFIFOSIZ-1)) != keyasciififoplc)
|
||||||
{
|
{
|
||||||
|
// printf("got char %d\n",code);
|
||||||
|
|
||||||
if (OSD_HandleChar(code))
|
if (OSD_HandleChar(code))
|
||||||
{
|
{
|
||||||
keyasciififo[keyasciififoend] = code;
|
keyasciififo[keyasciififoend] = code;
|
||||||
|
@ -1579,7 +1594,7 @@ int32_t handleevents(void)
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
case SDL_KEYUP:
|
case SDL_KEYUP:
|
||||||
code = keytranslation[ev.key.keysym.scancode];
|
code = keytranslation[ev.key.keysym.scancode];
|
||||||
// initprintf("got key %d, %d\n",ev.key.keysym.scancode,code);
|
// printf("got key %d, %d\n",ev.key.keysym.scancode,code);
|
||||||
|
|
||||||
// hook in the osd
|
// hook in the osd
|
||||||
if (OSD_HandleScanCode(code, (ev.key.type == SDL_KEYDOWN)) == 0)
|
if (OSD_HandleScanCode(code, (ev.key.type == SDL_KEYDOWN)) == 0)
|
||||||
|
@ -1645,7 +1660,9 @@ int32_t handleevents(void)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
#else
|
#warning "Using SDL 1.3"
|
||||||
|
#else // SDL 1.3 ^^^ | vvv SDL 1.2
|
||||||
|
#warning "Using SDL 1.2"
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
case SDL_KEYUP:
|
case SDL_KEYUP:
|
||||||
code = keytranslation[ev.key.keysym.sym];
|
code = keytranslation[ev.key.keysym.sym];
|
||||||
|
@ -1654,6 +1671,8 @@ int32_t handleevents(void)
|
||||||
(ev.key.keysym.unicode & 0xff80) == 0 &&
|
(ev.key.keysym.unicode & 0xff80) == 0 &&
|
||||||
((keyasciififoend+1)&(KEYFIFOSIZ-1)) != keyasciififoplc)
|
((keyasciififoend+1)&(KEYFIFOSIZ-1)) != keyasciififoplc)
|
||||||
{
|
{
|
||||||
|
// if (ev.type==SDL_KEYDOWN)
|
||||||
|
// printf("got char %d\n",ev.key.keysym.unicode & 0x7f);
|
||||||
if (OSD_HandleChar(ev.key.keysym.unicode & 0x7f))
|
if (OSD_HandleChar(ev.key.keysym.unicode & 0x7f))
|
||||||
{
|
{
|
||||||
keyasciififo[keyasciififoend] = ev.key.keysym.unicode & 0x7f;
|
keyasciififo[keyasciififoend] = ev.key.keysym.unicode & 0x7f;
|
||||||
|
@ -1662,6 +1681,8 @@ int32_t handleevents(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// hook in the osd
|
// hook in the osd
|
||||||
|
// if (ev.type==SDL_KEYDOWN)
|
||||||
|
// printf("got key %d\n",code);
|
||||||
if (OSD_HandleScanCode(code, (ev.key.type == SDL_KEYDOWN)) == 0)
|
if (OSD_HandleScanCode(code, (ev.key.type == SDL_KEYDOWN)) == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1808,6 +1829,8 @@ int32_t handleevents(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (mousex|mousey) printf("%d,%d\n",mousex,mousey); ///
|
||||||
|
|
||||||
sampletimer();
|
sampletimer();
|
||||||
|
|
||||||
if (moustat)
|
if (moustat)
|
||||||
|
@ -1841,6 +1864,43 @@ inline void idle_waitevent(void)
|
||||||
SDL_WaitEvent(NULL);
|
SDL_WaitEvent(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2
|
||||||
|
// from SDL HG, modified
|
||||||
|
static int32_t SDL_WaitEventTimeout(SDL_Event * event, int32_t timeout)
|
||||||
|
{
|
||||||
|
uint32_t expiration = 0;
|
||||||
|
|
||||||
|
if (timeout > 0)
|
||||||
|
expiration = SDL_GetTicks() + timeout;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
SDL_PumpEvents();
|
||||||
|
switch (SDL_PeepEvents(event, 1, SDL_GETEVENT, ~0)) { //SDL_FIRSTEVENT, SDL_LASTEVENT)) {
|
||||||
|
case -1:
|
||||||
|
return 0;
|
||||||
|
case 1:
|
||||||
|
return 1;
|
||||||
|
case 0:
|
||||||
|
if (timeout == 0) {
|
||||||
|
/* Polling and no events, just return */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (timeout > 0 && ((int32_t) (SDL_GetTicks() - expiration) >= 0)) {
|
||||||
|
/* Timeout expired and no events */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
SDL_Delay(10);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
inline void idle_waitevent_timeout(int32_t timeout)
|
||||||
|
{
|
||||||
|
SDL_WaitEventTimeout(NULL, timeout);
|
||||||
|
}
|
||||||
|
|
||||||
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2
|
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3) // SDL 1.2
|
||||||
static int32_t buildkeytranslationtable(void)
|
static int32_t buildkeytranslationtable(void)
|
||||||
{
|
{
|
||||||
|
@ -1975,7 +2035,7 @@ static int32_t buildkeytranslationtable(void)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else // SDL 1.3
|
#else // if SDL 1.3
|
||||||
static int32_t buildkeytranslationtable(void)
|
static int32_t buildkeytranslationtable(void)
|
||||||
{
|
{
|
||||||
memset(keytranslation,0,sizeof(keytranslation));
|
memset(keytranslation,0,sizeof(keytranslation));
|
||||||
|
|
|
@ -861,6 +861,11 @@ inline void idle_waitevent(void)
|
||||||
while (--i);
|
while (--i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void idle_waitevent_timeout(int32_t timeout)
|
||||||
|
{
|
||||||
|
idle_waitevent();
|
||||||
|
}
|
||||||
|
|
||||||
inline void idle(void)
|
inline void idle(void)
|
||||||
{
|
{
|
||||||
idle_waitevent();
|
idle_waitevent();
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -247,6 +247,8 @@ const char *keyw[] =
|
||||||
|
|
||||||
"displayrand",
|
"displayrand",
|
||||||
|
|
||||||
|
"itof",
|
||||||
|
"ftoi",
|
||||||
"clamp",
|
"clamp",
|
||||||
"inv", // inversion function.. not internal
|
"inv", // inversion function.. not internal
|
||||||
"sqrt",
|
"sqrt",
|
||||||
|
@ -2555,6 +2557,21 @@ repeatcase:
|
||||||
C_GetNextVarType(GAMEVAR_READONLY);
|
C_GetNextVarType(GAMEVAR_READONLY);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// *** float access: convert float to int and back
|
||||||
|
case CON_ITOF:
|
||||||
|
case CON_FTOI:
|
||||||
|
// syntax: itof <<var>> SCALE
|
||||||
|
// ftoi <<var>> SCALE
|
||||||
|
C_GetNextVarType(GAMEVAR_READONLY);
|
||||||
|
C_GetNextValue(LABEL_DEFINE);
|
||||||
|
|
||||||
|
if (*(g_scriptPtr-1)<=0)
|
||||||
|
{
|
||||||
|
initprintf("%s:%d: error: scale value in integer/float conversion must be greater zero.\n",g_szScriptFileName,g_lineNumber);
|
||||||
|
g_numCompilerErrors++;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
// *** other math
|
// *** other math
|
||||||
case CON_CLAMP:
|
case CON_CLAMP:
|
||||||
C_GetNextVarType(GAMEVAR_READONLY);
|
C_GetNextVarType(GAMEVAR_READONLY);
|
||||||
|
|
|
@ -313,6 +313,8 @@ enum ScriptKeywords_t
|
||||||
CON_DISPLAYRAND,
|
CON_DISPLAYRAND,
|
||||||
|
|
||||||
// other math
|
// other math
|
||||||
|
CON_ITOF,
|
||||||
|
CON_FTOI,
|
||||||
CON_CLAMP,
|
CON_CLAMP,
|
||||||
CON_INV,
|
CON_INV,
|
||||||
CON_SQRT,
|
CON_SQRT,
|
||||||
|
|
|
@ -89,6 +89,7 @@ static int32_t dist(spritetype *s1,spritetype *s2)
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
|
|
||||||
|
#if 0
|
||||||
void X_Disasm(ofstype beg, int32_t size)
|
void X_Disasm(ofstype beg, int32_t size)
|
||||||
{
|
{
|
||||||
instype *p;
|
instype *p;
|
||||||
|
@ -106,6 +107,7 @@ void X_Disasm(ofstype beg, int32_t size)
|
||||||
}
|
}
|
||||||
initprintf("\n");
|
initprintf("\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void VM_ScriptInfo(void)
|
void VM_ScriptInfo(void)
|
||||||
{
|
{
|
||||||
|
@ -828,6 +830,28 @@ skip_check:
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// *** other math
|
// *** other math
|
||||||
|
case CON_FTOI:
|
||||||
|
insptr++;
|
||||||
|
{
|
||||||
|
int32_t bits=Gv_GetVarX(*insptr), scale=*(insptr+1);
|
||||||
|
double fval=(double)(*((float*)&bits));
|
||||||
|
|
||||||
|
Gv_SetVarX(*insptr, (int32_t)((fval/scale)*2e9));
|
||||||
|
}
|
||||||
|
insptr += 2;
|
||||||
|
continue;
|
||||||
|
|
||||||
|
case CON_ITOF:
|
||||||
|
insptr++;
|
||||||
|
{
|
||||||
|
int32_t scaled=Gv_GetVarX(*insptr), scale=*(insptr+1);
|
||||||
|
float fval = (float)((((double)scaled)*scale)/2e9);
|
||||||
|
|
||||||
|
Gv_SetVarX(*insptr, *((int32_t *)&fval));
|
||||||
|
}
|
||||||
|
insptr += 2;
|
||||||
|
continue;
|
||||||
|
|
||||||
case CON_CLAMP:
|
case CON_CLAMP:
|
||||||
insptr++;
|
insptr++;
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "m32def.h"
|
#include "m32def.h"
|
||||||
#include "osd.h"
|
#include "osd.h"
|
||||||
#include "keys.h"
|
#include "keys.h"
|
||||||
|
#ifdef POLYMER
|
||||||
|
#include "polymer.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _m32vars_c_
|
#define _m32vars_c_
|
||||||
#include "m32structures.c"
|
#include "m32structures.c"
|
||||||
|
@ -159,7 +162,7 @@ int32_t Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
|
||||||
if (i >= 0 && !(aGameVars[i].dwFlags & GAMEVAR_RESET))
|
if (i >= 0 && !(aGameVars[i].dwFlags & GAMEVAR_RESET))
|
||||||
{
|
{
|
||||||
// found it...
|
// found it...
|
||||||
if (aGameVars[i].dwFlags & (GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
if (aGameVars[i].dwFlags & (GAMEVAR_INTPTR|GAMEVAR_FLOATPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
||||||
{
|
{
|
||||||
C_ReportError(-1);
|
C_ReportError(-1);
|
||||||
initprintf("%s:%d: warning: cannot redefine internal gamevar `%s'.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6));
|
initprintf("%s:%d: warning: cannot redefine internal gamevar `%s'.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6));
|
||||||
|
@ -232,12 +235,13 @@ int32_t __fastcall Gv_GetVarN(register int32_t id) // 'N' for "no side-effects"
|
||||||
id &= (MAXGAMEVARS-1);
|
id &= (MAXGAMEVARS-1);
|
||||||
|
|
||||||
switch (aGameVars[id].dwFlags &
|
switch (aGameVars[id].dwFlags &
|
||||||
(GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
(GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_FLOATPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return aGameVars[id].val.lValue;
|
return aGameVars[id].val.lValue;
|
||||||
case GAMEVAR_PERBLOCK:
|
case GAMEVAR_PERBLOCK:
|
||||||
return aGameVars[id].val.plValues[vm.g_st];
|
return aGameVars[id].val.plValues[vm.g_st];
|
||||||
|
case GAMEVAR_FLOATPTR:
|
||||||
case GAMEVAR_INTPTR:
|
case GAMEVAR_INTPTR:
|
||||||
return *((int32_t*)aGameVars[id].val.lValue);
|
return *((int32_t*)aGameVars[id].val.lValue);
|
||||||
case GAMEVAR_SHORTPTR:
|
case GAMEVAR_SHORTPTR:
|
||||||
|
@ -354,12 +358,18 @@ int32_t __fastcall Gv_GetVarX(register int32_t id)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (aGameVars[id].dwFlags &
|
switch (aGameVars[id].dwFlags &
|
||||||
(GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
(GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_FLOATPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult);
|
return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult);
|
||||||
case GAMEVAR_PERBLOCK:
|
case GAMEVAR_PERBLOCK:
|
||||||
return ((aGameVars[id].val.plValues[vm.g_st] ^ -negateResult) + negateResult);
|
return ((aGameVars[id].val.plValues[vm.g_st] ^ -negateResult) + negateResult);
|
||||||
|
case GAMEVAR_FLOATPTR:
|
||||||
|
if (negateResult)
|
||||||
|
{
|
||||||
|
float fval = -(*(float*)aGameVars[id].val.lValue);
|
||||||
|
return *(int32_t *)&fval;
|
||||||
|
}
|
||||||
case GAMEVAR_INTPTR:
|
case GAMEVAR_INTPTR:
|
||||||
return ((*((int32_t*)aGameVars[id].val.lValue) ^ -negateResult) + negateResult);
|
return ((*((int32_t*)aGameVars[id].val.lValue) ^ -negateResult) + negateResult);
|
||||||
case GAMEVAR_SHORTPTR:
|
case GAMEVAR_SHORTPTR:
|
||||||
|
@ -457,7 +467,7 @@ void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (aGameVars[id].dwFlags &
|
switch (aGameVars[id].dwFlags &
|
||||||
(GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
(GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_FLOATPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
aGameVars[id].val.lValue=lValue;
|
aGameVars[id].val.lValue=lValue;
|
||||||
|
@ -465,6 +475,17 @@ void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue)
|
||||||
case GAMEVAR_PERBLOCK:
|
case GAMEVAR_PERBLOCK:
|
||||||
aGameVars[id].val.plValues[vm.g_st] = lValue;
|
aGameVars[id].val.plValues[vm.g_st] = lValue;
|
||||||
return;
|
return;
|
||||||
|
case GAMEVAR_FLOATPTR:
|
||||||
|
{
|
||||||
|
int32_t ival = lValue;
|
||||||
|
float fval = *(float *)&ival;
|
||||||
|
if (fval!=fval || fval<-3.3e38 || fval > 3.3e38)
|
||||||
|
{
|
||||||
|
OSD_Printf(CON_ERROR "Gv_SetVarX(): tried to set float var to NaN or infinity\n",g_errorLineNum,keyw[g_tw]);
|
||||||
|
vm.flags |= VMFLAG_ERROR;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
case GAMEVAR_INTPTR:
|
case GAMEVAR_INTPTR:
|
||||||
*((int32_t*)aGameVars[id].val.lValue)=(int32_t)lValue;
|
*((int32_t*)aGameVars[id].val.lValue)=(int32_t)lValue;
|
||||||
return;
|
return;
|
||||||
|
@ -604,6 +625,15 @@ static void Gv_AddSystemVars(void)
|
||||||
Gv_NewVar("SV2",(intptr_t)&m32_sortvar2, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
Gv_NewVar("SV2",(intptr_t)&m32_sortvar2, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
||||||
Gv_NewVar("spritesortcnt",(intptr_t)&spritesortcnt, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
Gv_NewVar("spritesortcnt",(intptr_t)&spritesortcnt, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
||||||
|
|
||||||
|
#ifdef POLYMER
|
||||||
|
Gv_NewVar("pr_overrideparallax",(intptr_t)&pr_overrideparallax, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||||
|
Gv_NewVar("pr_parallaxscale",(intptr_t)&pr_parallaxscale, GAMEVAR_FLOATPTR | GAMEVAR_SYSTEM);
|
||||||
|
Gv_NewVar("pr_parallaxbias",(intptr_t)&pr_parallaxbias, GAMEVAR_FLOATPTR | GAMEVAR_SYSTEM);
|
||||||
|
Gv_NewVar("pr_overridespecular",(intptr_t)&pr_overridespecular, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||||
|
Gv_NewVar("pr_specularpower",(intptr_t)&pr_specularpower, GAMEVAR_FLOATPTR | GAMEVAR_SYSTEM);
|
||||||
|
Gv_NewVar("pr_specularfactor",(intptr_t)&pr_specularfactor, GAMEVAR_FLOATPTR | GAMEVAR_SYSTEM);
|
||||||
|
#endif
|
||||||
|
|
||||||
g_systemVarCount = g_gameVarCount;
|
g_systemVarCount = g_gameVarCount;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,8 @@ extern int16_t searchbottomwall;
|
||||||
static int32_t ototalclock = 0;
|
static int32_t ototalclock = 0;
|
||||||
|
|
||||||
#define NUMOPTIONS 9
|
#define NUMOPTIONS 9
|
||||||
|
|
||||||
char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
|
char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
|
||||||
|
|
||||||
uint8_t keys[NUMBUILDKEYS] =
|
uint8_t keys[NUMBUILDKEYS] =
|
||||||
{
|
{
|
||||||
0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39,
|
0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39,
|
||||||
|
@ -72,35 +72,38 @@ extern int32_t lastpm16time, synctics;
|
||||||
extern int32_t halfxdim16, midydim16, zoom;
|
extern int32_t halfxdim16, midydim16, zoom;
|
||||||
extern void fixrepeats(int16_t i);
|
extern void fixrepeats(int16_t i);
|
||||||
|
|
||||||
char autospritehelp=0,autosecthelp=0;
|
static char autospritehelp=0,autosecthelp=0;
|
||||||
int16_t MinRate=24, MinD=3;
|
//int16_t MinRate=24, MinD=3;
|
||||||
int32_t xoldtimerhandler, lastmessagetime=-1;
|
//int32_t xoldtimerhandler;
|
||||||
|
static int32_t lastmessagetime=-1;
|
||||||
|
|
||||||
char tempbuf[1024]; //1024
|
static char tempbuf[1024];
|
||||||
int32_t numsprite[MAXSPRITES];
|
static int32_t numsprite[MAXSPRITES], multisprite[MAXSPRITES];
|
||||||
int32_t multisprite[MAXSPRITES];
|
static char lo[64];
|
||||||
char lo[64];
|
static char levelname[255];
|
||||||
char levelname[255];
|
static int16_t curwall=0, curwallnum=0;
|
||||||
int16_t curwall=0,curwallnum=0;
|
static int16_t /*cursearchsprite=0,*/ cursearchspritenum=0, cursector_lotag=0, cursectornum=0;
|
||||||
int16_t cursearchsprite=0,cursearchspritenum=0,cursector_lotag=0,cursectornum=0;
|
static int16_t search_lotag=0,search_hitag=0;
|
||||||
int16_t search_lotag=0,search_hitag=0;
|
static char wallsprite=0;
|
||||||
char wallsprite=0;
|
static char helpon=0;
|
||||||
char helpon=0;
|
|
||||||
//static char onwater=0;
|
//static char onwater=0;
|
||||||
uint8_t onnames=4, usedcount=1;
|
static uint8_t onnames=4, usedcount=1;
|
||||||
int16_t cursprite;
|
static int16_t cursprite;
|
||||||
int32_t mousxplc, mousyplc, ppointhighlight;
|
int32_t mousxplc, mousyplc;
|
||||||
int32_t counter=0;
|
static int32_t ppointhighlight;
|
||||||
uint8_t nosprites=0,purpleon=0,skill=4;
|
//static int32_t counter=0;
|
||||||
uint8_t framerateon=1,shadepreview=0,sidemode=0;
|
static uint8_t nosprites=0,purpleon=0,skill=4;
|
||||||
int32_t autosave=180;
|
static uint8_t framerateon=1,shadepreview=0,sidemode=0;
|
||||||
extern int32_t vel, svel, hvel, angvel;
|
static int32_t xvel, yvel, timoff;
|
||||||
int32_t xvel, yvel, timoff;
|
|
||||||
|
|
||||||
static void SearchSectorsForward();
|
int32_t autosave=180;
|
||||||
static void SearchSectorsBackward();
|
static int32_t autosavetimer;
|
||||||
|
|
||||||
|
extern int32_t vel, svel, hvel, angvel;
|
||||||
|
|
||||||
|
static void SearchSectors(int32_t dir);
|
||||||
static inline void SpriteName(int16_t spritenum, char *lo2);
|
static inline void SpriteName(int16_t spritenum, char *lo2);
|
||||||
static void PrintStatus(char *string,int32_t num,char x,char y,char color);
|
static void PrintStatus(const char *string,int32_t num,char x,char y,char color);
|
||||||
void SetBOSS1Palette();
|
void SetBOSS1Palette();
|
||||||
void SetSLIMEPalette();
|
void SetSLIMEPalette();
|
||||||
void SetWATERPalette();
|
void SetWATERPalette();
|
||||||
|
@ -113,32 +116,33 @@ static void EditWallData(int16_t wallnum);
|
||||||
static void EditSectorData(int16_t sectnum);
|
static void EditSectorData(int16_t sectnum);
|
||||||
static void FuncMenu(void);
|
static void FuncMenu(void);
|
||||||
|
|
||||||
uint8_t GAMEpalette[768], WATERpalette[768], SLIMEpalette[768], TITLEpalette[768];
|
static uint8_t GAMEpalette[768], WATERpalette[768], SLIMEpalette[768], TITLEpalette[768];
|
||||||
uint8_t REALMSpalette[768], BOSS1palette[768];
|
static uint8_t REALMSpalette[768], BOSS1palette[768];
|
||||||
|
|
||||||
char num_tables;
|
static char num_tables;
|
||||||
|
|
||||||
|
static int32_t updownunits=1024;
|
||||||
|
|
||||||
int32_t updownunits=1024;
|
|
||||||
extern int16_t highlightsector[MAXSECTORS], highlightsectorcnt;
|
extern int16_t highlightsector[MAXSECTORS], highlightsectorcnt;
|
||||||
extern int16_t highlight[MAXWALLS];
|
extern int16_t highlight[MAXWALLS];
|
||||||
extern int16_t pointhighlight, linehighlight, highlightcnt;
|
extern int16_t pointhighlight, linehighlight, highlightcnt;
|
||||||
extern int16_t asksave;
|
extern int16_t asksave;
|
||||||
|
|
||||||
char getmessage[162], getmessageleng;
|
static char getmessage[162], getmessageleng;
|
||||||
int32_t getmessagetimeoff, charsperline;
|
static int32_t getmessagetimeoff; //, charsperline;
|
||||||
|
|
||||||
extern int32_t startposx, startposy, startposz;
|
extern int32_t startposx, startposy, startposz;
|
||||||
extern int16_t startang, startsectnum;
|
extern int16_t startang, startsectnum;
|
||||||
|
|
||||||
int32_t autosavetimer;
|
|
||||||
extern int32_t numsprites;
|
extern int32_t numsprites;
|
||||||
extern int32_t showfirstwall;
|
extern int32_t showfirstwall;
|
||||||
extern char spritecol2d[MAXTILES][2];
|
extern char spritecol2d[MAXTILES][2];
|
||||||
extern char custom2dcolors;
|
extern char custom2dcolors;
|
||||||
|
|
||||||
int32_t intro=0;
|
//int32_t intro=0;
|
||||||
extern int32_t ydim16, halfxdim16, midydim16, zoom;
|
extern int32_t ydim16, halfxdim16, midydim16, zoom;
|
||||||
extern intptr_t frameplace;
|
extern intptr_t frameplace;
|
||||||
extern char pow2char[8];
|
//extern char pow2char[8];
|
||||||
|
|
||||||
static int32_t acurpalette=0;
|
static int32_t acurpalette=0;
|
||||||
|
|
||||||
|
@ -149,34 +153,32 @@ extern int32_t checksectorpointer(int16_t i, int16_t sectnum);
|
||||||
|
|
||||||
extern double msens;
|
extern double msens;
|
||||||
|
|
||||||
void ContextHelp(int16_t spritenum);
|
//void ContextHelp(int16_t spritenum);
|
||||||
void ResetKeys();
|
//void ResetKeys();
|
||||||
|
|
||||||
extern void fixspritesectors(void);
|
extern void fixspritesectors(void);
|
||||||
#define KEY_PRESSED(sc) KB_KeyPressed((sc))
|
//#define KEY_PRESSED(sc) KB_KeyPressed((sc))
|
||||||
|
|
||||||
// This table defines the various zoom levels, the numbers being the pixel width
|
// This table defines the various zoom levels, the numbers being the pixel width
|
||||||
// and height of the sprite when plotted on the screen. Probably zooms in too far
|
// and height of the sprite when plotted on the screen. Probably zooms in too far
|
||||||
// for some, but I'm a blind old git :-(
|
// for some, but I'm a blind old git :-(
|
||||||
|
|
||||||
#define FUCKING_GOOD_EYESIGHT 16
|
#define FUCKING_GOOD_EYESIGHT 16
|
||||||
|
|
||||||
static const int32_t ZoomToThumbSize[] =
|
static const int32_t ZoomToThumbSize[] =
|
||||||
{
|
{
|
||||||
FUCKING_GOOD_EYESIGHT, 32, 64, 128, 192, 256, 384, 512
|
FUCKING_GOOD_EYESIGHT, 32, 64, 128, 192, 256, 384, 512
|
||||||
} ;
|
};
|
||||||
|
|
||||||
#define NUM_ZOOMS (sizeof(ZoomToThumbSize)/sizeof(ZoomToThumbSize[0]))
|
#define NUM_ZOOMS (sizeof(ZoomToThumbSize)/sizeof(ZoomToThumbSize[0]))
|
||||||
|
|
||||||
#define INITIAL_ZOOM 2
|
#define INITIAL_ZOOM 2
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int32_t *pIds ; // ptr to list of tile Ids
|
int32_t *pIds; // ptr to list of tile Ids
|
||||||
int32_t nIds ; // num of tile ids
|
int32_t nIds; // num of tile ids
|
||||||
char *szText ; // description to present to user.
|
char *szText; // description to present to user.
|
||||||
char key1 ; // key1 and key2 are two alternative keypresses used to
|
char key1; // key1 and key2 are two alternative keypresses used to
|
||||||
char key2 ; // select tile set. Bodge to do eary upper/lower case handling
|
char key2; // select tile set. Bodge to do eary upper/lower case handling
|
||||||
char color1; // 2d sprite color 1
|
char color1; // 2d sprite color 1
|
||||||
char color2; // 2d sprite color 2
|
char color2; // 2d sprite color 2
|
||||||
} TileGroup;
|
} TileGroup;
|
||||||
|
@ -184,13 +186,12 @@ typedef struct
|
||||||
#define MAX_TILE_GROUPS 32
|
#define MAX_TILE_GROUPS 32
|
||||||
#define MAX_TILE_GROUP_ENTRIES 1024
|
#define MAX_TILE_GROUP_ENTRIES 1024
|
||||||
|
|
||||||
TileGroup s_TileGroups[MAX_TILE_GROUPS];
|
static TileGroup s_TileGroups[MAX_TILE_GROUPS];
|
||||||
|
static int32_t tilegroupItems;
|
||||||
int32_t tilegroupItems;
|
static int32_t tilegroupActors;
|
||||||
int32_t tilegroupActors;
|
|
||||||
|
|
||||||
static uint32_t tile_groups = 0;
|
static uint32_t tile_groups = 0;
|
||||||
|
|
||||||
|
|
||||||
#define NUMPRINTABLES 94
|
#define NUMPRINTABLES 94
|
||||||
#define MAX_ALPHABETS 32
|
#define MAX_ALPHABETS 32
|
||||||
// alphabet definitions struct for the sprite text renderer
|
// alphabet definitions struct for the sprite text renderer
|
||||||
|
@ -201,7 +202,7 @@ typedef struct
|
||||||
int8_t yofs[NUMPRINTABLES];
|
int8_t yofs[NUMPRINTABLES];
|
||||||
} alphabet_t;
|
} alphabet_t;
|
||||||
|
|
||||||
alphabet_t alphabets[MAX_ALPHABETS];
|
static alphabet_t alphabets[MAX_ALPHABETS];
|
||||||
static int32_t numalphabets = 0;
|
static int32_t numalphabets = 0;
|
||||||
|
|
||||||
#define FIRST_USER_ART_TILE 3584
|
#define FIRST_USER_ART_TILE 3584
|
||||||
|
@ -216,8 +217,8 @@ extern int16_t localartlookup[MAXTILES], localartlookupnum;
|
||||||
extern int32_t lockclock;
|
extern int32_t lockclock;
|
||||||
extern void clearkeys(void);
|
extern void clearkeys(void);
|
||||||
|
|
||||||
int32_t gs_sprite[3][7];
|
static int32_t gs_sprite[3][7];
|
||||||
char gs_spritewhat[3][7];
|
static char gs_spritewhat[3][7];
|
||||||
int16_t gs_cursprite=-1;
|
static int16_t gs_cursprite=-1;
|
||||||
|
|
||||||
int32_t g_musicSize=0;
|
int32_t g_musicSize=0;
|
||||||
|
|
177
polymer/eduke32/source/old.diff
Normal file
177
polymer/eduke32/source/old.diff
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
// All things old go here to keep the sources clean. To have a reference to the place
|
||||||
|
// in the code, place a marker like __SomeMarker__ in the source file, and refer to it
|
||||||
|
// by placing it as the first context line of the corresponding hunk.
|
||||||
|
|
||||||
|
Index: astub.c
|
||||||
|
==============================
|
||||||
|
+++ astub.c
|
||||||
|
--- astub.c
|
||||||
|
@@ -2118,1 +2118,37 @@
|
||||||
|
///__ShowHelpText__
|
||||||
|
+#if 0
|
||||||
|
+static void ShowHelpText(char *name)
|
||||||
|
+{
|
||||||
|
+ BFILE *fp;
|
||||||
|
+ char x=0,y=4;
|
||||||
|
+ UNREFERENCED_PARAMETER(name);
|
||||||
|
+ if ((fp=fopenfrompath("helpdoc.txt","rb")) == NULL)
|
||||||
|
+ {
|
||||||
|
+ begindrawing();
|
||||||
|
+ printext256(1*4,4*8,whitecol,-1,"ERROR: file not found.",0);
|
||||||
|
+ enddrawing();
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ /*
|
||||||
|
+ Bfgets(tempbuf,80,fp);
|
||||||
|
+ while(!Bfeof(fp) && Bstrcmp(tempbuf,"SectorEffector"))
|
||||||
|
+ {
|
||||||
|
+ Bfgets(tempbuf,80,fp);
|
||||||
|
+ }
|
||||||
|
+ */
|
||||||
|
+ y=2;
|
||||||
|
+ Bfgets(tempbuf,80,fp);
|
||||||
|
+ Bstrcat(tempbuf,"\n");
|
||||||
|
+ begindrawing();
|
||||||
|
+ while (!Bfeof(fp) && !(Bstrcmp(tempbuf,"SectorEffector")==0))
|
||||||
|
+ {
|
||||||
|
+ Bfgets(tempbuf,80,fp);
|
||||||
|
+ Bstrcat(tempbuf,"\n");
|
||||||
|
+ printext256(x*4,(y*6)+2,whitecol,-1,tempbuf,1);
|
||||||
|
+ y++;
|
||||||
|
+ }
|
||||||
|
+ enddrawing();
|
||||||
|
+
|
||||||
|
+ Bfclose(fp);
|
||||||
|
+}// end ShowHelpText
|
||||||
|
+#endif
|
||||||
|
@@ -6777,1 +6777,34 @@
|
||||||
|
///__bigcomment__
|
||||||
|
+ /*
|
||||||
|
+ if ((totalclock > getmessagetimeoff) && (totalclock > (lastpm16time + 120*3)))
|
||||||
|
+ {
|
||||||
|
+ if (pointhighlight >= 16384)
|
||||||
|
+ {
|
||||||
|
+ char tmpbuf[2048];
|
||||||
|
+ i = pointhighlight-16384;
|
||||||
|
+ if (strlen(names[sprite[i].picnum]) > 0)
|
||||||
|
+ {
|
||||||
|
+ if (sprite[i].picnum==SECTOREFFECTOR)
|
||||||
|
+ Bsprintf(tmpbuf,"Sprite %d %s, hi:%d ex:%d",i,SectorEffectorText(i),sprite[i].hitag,sprite[i].extra);
|
||||||
|
+ else Bsprintf(tmpbuf,"Sprite %d %s: lo:%d hi:%d ex:%d",i,names[sprite[i].picnum],sprite[i].lotag,sprite[i].hitag,sprite[i].extra);
|
||||||
|
+ }
|
||||||
|
+ else Bsprintf(tmpbuf,"Sprite %d picnum %d: lo:%d hi:%d ex:%d",i,sprite[i].picnum,sprite[i].lotag,sprite[i].hitag,sprite[i].extra);
|
||||||
|
+ _printmessage16(tmpbuf);
|
||||||
|
+ }
|
||||||
|
+ else if ((linehighlight >= 0) && (sectorofwall(linehighlight) == cursectornum))
|
||||||
|
+ {
|
||||||
|
+ int32_t dax, day, dist;
|
||||||
|
+ dax = wall[linehighlight].x-wall[wall[linehighlight].point2].x;
|
||||||
|
+ day = wall[linehighlight].y-wall[wall[linehighlight].point2].y;
|
||||||
|
+ dist = ksqrt(dax*dax+day*day);
|
||||||
|
+ Bsprintf(tempbuf,"Wall %d: length:%d lo:%d hi:%d ex:%d",linehighlight,dist,wall[linehighlight].lotag,wall[linehighlight].hitag,wall[linehighlight].extra);
|
||||||
|
+ _printmessage16(tempbuf);
|
||||||
|
+ }
|
||||||
|
+ else if (cursectornum >= 0)
|
||||||
|
+ {
|
||||||
|
+ Bsprintf(tempbuf,"Sector %d: lo:%d hi:%d ex:%d",cursectornum,sector[cursectornum].lotag,sector[cursectornum].hitag,sector[cursectornum].extra);
|
||||||
|
+ _printmessage16(tempbuf);
|
||||||
|
+ }
|
||||||
|
+ else _printmessage16("");
|
||||||
|
+ }
|
||||||
|
+ */
|
||||||
|
@@ -6723,1 +6723,29 @@
|
||||||
|
///__old_sprite_search_1__
|
||||||
|
+#if 0
|
||||||
|
+ {
|
||||||
|
+ if (cursearchspritenum>0) cursearchspritenum--;
|
||||||
|
+ for (i=cursearchspritenum; i>=0; i--)
|
||||||
|
+ {
|
||||||
|
+
|
||||||
|
+ if (
|
||||||
|
+ (sprite[i].picnum==sprite[cursearchsprite].picnum &&
|
||||||
|
+ sprite[i].statnum==0)
|
||||||
|
+ &&((search_lotag==0)||
|
||||||
|
+ (search_lotag!=0 && search_lotag==sprite[i].lotag))
|
||||||
|
+ &&((search_hitag==0)||
|
||||||
|
+ (search_hitag!=0 && search_hitag==sprite[i].hitag))
|
||||||
|
+ )
|
||||||
|
+ {
|
||||||
|
+ pos.x=sprite[i].x;
|
||||||
|
+ pos.y=sprite[i].y;
|
||||||
|
+ ang= sprite[i].ang;
|
||||||
|
+ printmessage16("< Sprite search: found");
|
||||||
|
+ // curspritenum--;
|
||||||
|
+ keystatus[KEYSC_LBRACK]=0;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ cursearchspritenum--;
|
||||||
|
+ }
|
||||||
|
+ printmessage16("< Sprite search: none found");
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
@@ -6757,1 +6757,27 @@
|
||||||
|
///__old_sprite_search_2__
|
||||||
|
+#if 0
|
||||||
|
+ {
|
||||||
|
+ if (cursearchspritenum<MAXSPRITES) cursearchspritenum++;
|
||||||
|
+ for (i=cursearchspritenum; i<=MAXSPRITES; i++)
|
||||||
|
+ {
|
||||||
|
+ if ((sprite[i].picnum==sprite[cursearchsprite].picnum &&
|
||||||
|
+ sprite[i].statnum==0)
|
||||||
|
+ &&((search_lotag==0)||
|
||||||
|
+ (search_lotag!=0 && search_lotag==sprite[i].lotag))
|
||||||
|
+ &&((search_hitag==0)||
|
||||||
|
+ (search_hitag!=0 && search_hitag==sprite[i].hitag))
|
||||||
|
+ )
|
||||||
|
+ {
|
||||||
|
+ pos.x=sprite[i].x;
|
||||||
|
+ pos.y=sprite[i].y;
|
||||||
|
+ ang= sprite[i].ang;
|
||||||
|
+ printmessage16("> Sprite search: found");
|
||||||
|
+ // curspritenum++;
|
||||||
|
+ keystatus[KEYSC_RBRACK]=0;
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ cursearchspritenum++;
|
||||||
|
+ }
|
||||||
|
+ printmessage16("> Sprite search: none found");
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
@@ -6840,1 +6840,37 @@
|
||||||
|
///__motorcycle__
|
||||||
|
+ /*
|
||||||
|
+ if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(5)) // ' 5
|
||||||
|
+ {
|
||||||
|
+ sprintf(tempbuf,"Power-Up Ammo now equals Normal");
|
||||||
|
+ printmessage16(tempbuf);
|
||||||
|
+ for(i=0;i<MAXSPRITES;i++)
|
||||||
|
+ {
|
||||||
|
+ if(sprite[i].picnum>=20 && sprite[i].picnum<=59)
|
||||||
|
+ {
|
||||||
|
+ sprite[i].xrepeat = 32;
|
||||||
|
+ sprite[i].yrepeat = 32;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+ // What the fuck is this supposed to do?
|
||||||
|
+
|
||||||
|
+ /* Motorcycle ha ha ha
|
||||||
|
+ if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(5)) // ' 5
|
||||||
|
+ {
|
||||||
|
+ sidemode++; if (sidemode > 2) sidemode = 0;
|
||||||
|
+ if (sidemode == 1)
|
||||||
|
+ {
|
||||||
|
+ editstatus = 0;
|
||||||
|
+ zmode = 2;
|
||||||
|
+ pos.z = ((sector[cursectnum].ceilingz+sector[cursectnum].floorz)>>1);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ editstatus = 1;
|
||||||
|
+ zmode = 1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ */
|
Loading…
Reference in a new issue