2008-05-16 19:51:38 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2004, 2007 - EDuke32 developers
|
|
|
|
|
|
|
|
This file is part of EDuke32
|
|
|
|
|
|
|
|
EDuke32 is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "compat.h"
|
|
|
|
|
|
|
|
#define TICSPERFRAME 3
|
|
|
|
|
|
|
|
// #define VULGARITY
|
|
|
|
|
|
|
|
char *defsfilename = "duke3d.def";
|
|
|
|
|
|
|
|
extern char keystatus[];
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int16_t defaultspritecstat;
|
2009-01-13 12:23:18 +00:00
|
|
|
extern int32_t horiz, qsetmode;
|
|
|
|
extern vec3_t pos;
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int16_t ang, cursectnum;
|
|
|
|
extern int16_t ceilingheinum, floorheinum;
|
2008-05-16 19:51:38 +00:00
|
|
|
extern char names[MAXTILES][25];
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d;
|
2008-05-16 19:51:38 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t zmode, kensplayerheight, zlock;
|
2008-05-16 19:51:38 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int16_t editstatus, searchit;
|
|
|
|
extern int32_t searchx, searchy, osearchx, osearchy; //search input
|
|
|
|
extern int16_t searchsector, searchwall, searchstat; //search output
|
2009-07-25 20:16:22 +00:00
|
|
|
extern int16_t searchbottomwall;
|
2008-05-16 19:51:38 +00:00
|
|
|
|
2008-08-09 06:08:24 +00:00
|
|
|
#define COLOR_RED 248
|
|
|
|
#define COLOR_WHITE 31
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
static int32_t ototalclock = 0;
|
2008-05-16 19:51:38 +00:00
|
|
|
|
|
|
|
#define NUMOPTIONS 9
|
|
|
|
|
|
|
|
char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
|
2009-01-09 09:29:17 +00:00
|
|
|
uint8_t keys[NUMBUILDKEYS] =
|
2009-01-10 07:38:50 +00:00
|
|
|
{
|
|
|
|
0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39,
|
|
|
|
0x1e,0x2c,0xd1,0xc9,0x47,0x49,
|
2008-05-16 19:51:38 +00:00
|
|
|
0x9c,0x1c,0xd,0xc,0xf,0x29
|
2009-01-10 07:38:50 +00:00
|
|
|
};
|
2008-05-16 19:51:38 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t nextvoxid = 0;
|
2008-05-16 19:51:38 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t whitecol;
|
2008-05-16 19:51:38 +00:00
|
|
|
extern char vgapal16[4*256];
|
2009-01-09 09:29:17 +00:00
|
|
|
extern void AutoAlignWalls(int32_t nWall0, int32_t ply);
|
|
|
|
extern char changechar(char dachar, int32_t dadir, char smooshyalign, char boundcheck);
|
2008-05-16 19:51:38 +00:00
|
|
|
extern void updatenumsprites(void);
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t lastpm16time, synctics;
|
|
|
|
extern int32_t halfxdim16, midydim16, zoom;
|
|
|
|
extern void fixrepeats(int16_t i);
|
2008-05-16 19:51:38 +00:00
|
|
|
|
|
|
|
char autospritehelp=0,autosecthelp=0;
|
2009-01-09 09:29:17 +00:00
|
|
|
int16_t MinRate=24, MinD=3;
|
|
|
|
int32_t xoldtimerhandler, lastmessagetime=-1;
|
2008-05-16 19:51:38 +00:00
|
|
|
|
|
|
|
char tempbuf[1024]; //1024
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t numsprite[MAXSPRITES];
|
|
|
|
int32_t multisprite[MAXSPRITES];
|
2009-04-07 18:56:22 +00:00
|
|
|
char lo[64];
|
2008-05-16 19:51:38 +00:00
|
|
|
char levelname[255];
|
2009-01-09 09:29:17 +00:00
|
|
|
int16_t curwall=0,curwallnum=0;
|
|
|
|
int16_t cursearchsprite=0,cursearchspritenum=0,cursector_lotag=0,cursectornum=0;
|
|
|
|
int16_t search_lotag=0,search_hitag=0;
|
2008-05-16 19:51:38 +00:00
|
|
|
char wallsprite=0;
|
|
|
|
char helpon=0;
|
|
|
|
//static char onwater=0;
|
2009-01-09 09:29:17 +00:00
|
|
|
uint8_t onnames=4, usedcount=1;
|
|
|
|
int16_t cursprite;
|
|
|
|
int32_t mousxplc, mousyplc, ppointhighlight;
|
|
|
|
int32_t counter=0;
|
|
|
|
uint8_t nosprites=0,purpleon=0,skill=4;
|
|
|
|
uint8_t framerateon=1,shadepreview=0,sidemode=0;
|
|
|
|
int32_t autosave=180;
|
|
|
|
extern int32_t vel, svel, hvel, angvel;
|
|
|
|
int32_t xvel, yvel, timoff;
|
2008-05-16 19:51:38 +00:00
|
|
|
|
|
|
|
static void SearchSectorsForward();
|
|
|
|
static void SearchSectorsBackward();
|
2009-01-09 09:29:17 +00:00
|
|
|
static inline void SpriteName(int16_t spritenum, char *lo2);
|
|
|
|
static void PrintStatus(char *string,int32_t num,char x,char y,char color);
|
2008-07-25 13:42:37 +00:00
|
|
|
static inline void SetBOSS1Palette();
|
|
|
|
static inline void SetSLIMEPalette();
|
|
|
|
static inline void SetWATERPalette();
|
|
|
|
static inline void SetGAMEPalette();
|
2008-05-16 19:51:38 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int16_t grid;
|
2008-05-16 19:51:38 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
static void EditSpriteData(int16_t spritenum);
|
|
|
|
static void EditWallData(int16_t wallnum);
|
|
|
|
static void EditSectorData(int16_t sectnum);
|
2008-05-16 19:51:38 +00:00
|
|
|
static void FuncMenu(void);
|
|
|
|
|
2009-01-10 07:38:50 +00:00
|
|
|
uint8_t GAMEpalette[768], WATERpalette[768], SLIMEpalette[768], TITLEpalette[768];
|
|
|
|
uint8_t REALMSpalette[768], BOSS1palette[768];
|
2008-05-16 19:51:38 +00:00
|
|
|
|
|
|
|
char num_tables;
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t updownunits=1024;
|
|
|
|
extern int16_t highlightsector[MAXSECTORS], highlightsectorcnt;
|
|
|
|
extern int16_t highlight[MAXWALLS];
|
|
|
|
extern int16_t pointhighlight, linehighlight, highlightcnt;
|
|
|
|
extern int16_t asksave;
|
2008-05-16 19:51:38 +00:00
|
|
|
|
|
|
|
char getmessage[162], getmessageleng;
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t getmessagetimeoff, charsperline;
|
|
|
|
extern int32_t startposx, startposy, startposz;
|
|
|
|
extern int16_t startang, startsectnum;
|
2008-05-16 19:51:38 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t autosavetimer;
|
|
|
|
extern int32_t numsprites;
|
|
|
|
extern int32_t showfirstwall;
|
2008-05-16 19:51:38 +00:00
|
|
|
extern char spritecol2d[MAXTILES][2];
|
|
|
|
extern char custom2dcolors;
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t intro=0;
|
|
|
|
extern int32_t ydim16, halfxdim16, midydim16, zoom;
|
2008-05-16 19:51:38 +00:00
|
|
|
extern intptr_t frameplace;
|
|
|
|
extern char pow2char[8];
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
static int32_t acurpalette=0;
|
2008-05-16 19:51:38 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern void showsectordata(int16_t sectnum);
|
|
|
|
extern void showwalldata(int16_t wallnum);
|
|
|
|
extern void showspritedata(int16_t spritenum);
|
|
|
|
extern int32_t checksectorpointer(int16_t i, int16_t sectnum);
|
2008-05-16 19:51:38 +00:00
|
|
|
|
|
|
|
extern double msens;
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void ContextHelp(int16_t spritenum);
|
2008-05-16 19:51:38 +00:00
|
|
|
void ResetKeys();
|
|
|
|
|
|
|
|
extern void fixspritesectors(void);
|
|
|
|
#define KEY_PRESSED(sc) KB_KeyPressed((sc))
|
|
|
|
|
|
|
|
// 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
|
|
|
|
// for some, but I'm a blind old git :-(
|
|
|
|
|
|
|
|
#define FUCKING_GOOD_EYESIGHT 16
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
static const int32_t ZoomToThumbSize[] =
|
2008-05-16 19:51:38 +00:00
|
|
|
{
|
|
|
|
FUCKING_GOOD_EYESIGHT, 32, 64, 128, 192, 256, 384, 512
|
|
|
|
} ;
|
|
|
|
|
|
|
|
#define NUM_ZOOMS (sizeof(ZoomToThumbSize)/sizeof(ZoomToThumbSize[0]))
|
|
|
|
|
|
|
|
#define INITIAL_ZOOM 2
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t *pIds ; // ptr to list of tile Ids
|
|
|
|
int32_t nIds ; // num of tile ids
|
2008-05-16 19:51:38 +00:00
|
|
|
char *szText ; // description to present to user.
|
|
|
|
char key1 ; // key1 and key2 are two alternative keypresses used to
|
|
|
|
char key2 ; // select tile set. Bodge to do eary upper/lower case handling
|
2008-07-14 01:48:20 +00:00
|
|
|
char color1; // 2d sprite color 1
|
|
|
|
char color2; // 2d sprite color 2
|
2008-05-16 19:51:38 +00:00
|
|
|
} TileGroup;
|
|
|
|
|
|
|
|
#define MAX_TILE_GROUPS 32
|
|
|
|
#define MAX_TILE_GROUP_ENTRIES 1024
|
|
|
|
|
|
|
|
TileGroup s_TileGroups[MAX_TILE_GROUPS];
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t tilegroupItems;
|
|
|
|
int32_t tilegroupActors;
|
2008-07-14 01:48:20 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
static uint32_t tile_groups = 0;
|
2008-05-16 19:51:38 +00:00
|
|
|
|
2008-09-11 21:22:58 +00:00
|
|
|
#define NUMPRINTABLES 94
|
|
|
|
#define MAX_ALPHABETS 32
|
|
|
|
// alphabet definitions struct for the sprite text renderer
|
|
|
|
typedef struct
|
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int16_t pic[NUMPRINTABLES]; // maps printable ASCII chars to tilenums
|
|
|
|
int8_t xofs[NUMPRINTABLES]; // additional offset
|
|
|
|
int8_t yofs[NUMPRINTABLES];
|
2008-09-11 21:22:58 +00:00
|
|
|
} alphabet_t;
|
|
|
|
|
|
|
|
alphabet_t alphabets[MAX_ALPHABETS];
|
2009-01-09 09:29:17 +00:00
|
|
|
static int32_t numalphabets = 0;
|
2008-09-11 21:22:58 +00:00
|
|
|
|
2008-05-16 19:51:38 +00:00
|
|
|
#define FIRST_USER_ART_TILE 3584
|
|
|
|
// Some atomic tiles are sprinkled in the V1.3d's area but
|
|
|
|
// this is where the main atomic tiles start :-
|
|
|
|
#define FIRST_ATOMIC_TILE 4096
|
|
|
|
#define FIRST_EXTENDED_TILE 6144
|
|
|
|
#define SECOND_EXTENDED_TILE 9216
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int16_t localartfreq[MAXTILES];
|
|
|
|
extern int16_t localartlookup[MAXTILES], localartlookupnum;
|
|
|
|
extern int32_t lockclock;
|
2008-05-16 19:51:38 +00:00
|
|
|
extern void clearkeys(void);
|
2008-09-12 13:41:18 +00:00
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t gs_sprite[3][7];
|
2008-09-19 20:09:43 +00:00
|
|
|
char gs_spritewhat[3][7];
|
2009-01-09 09:29:17 +00:00
|
|
|
int16_t gs_cursprite=-1;
|
2009-03-16 15:18:01 +00:00
|
|
|
|
|
|
|
int32_t g_musicSize=0;
|