From 62ae233489c0afb609009688919cf5d3a59598ff Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 17 Apr 2007 05:54:12 +0000 Subject: [PATCH] Newer tile selector from Mapfun and some other stuff git-svn-id: https://svn.eduke32.com/eduke32@534 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/include/osd.h | 2 +- polymer/build/src/build.c | 4 +- polymer/build/src/osd.c | 12 +- polymer/eduke32/source/astub.c | 1214 ++++++++++++++++++++++++++-- polymer/eduke32/source/game.c | 14 +- polymer/eduke32/source/gamevars.c | 76 ++ polymer/eduke32/source/mapster32.h | 185 +++++ 7 files changed, 1413 insertions(+), 94 deletions(-) diff --git a/polymer/build/include/osd.h b/polymer/build/include/osd.h index e4c17b940..ecf21ebac 100644 --- a/polymer/build/include/osd.h +++ b/polymer/build/include/osd.h @@ -55,7 +55,7 @@ void OSD_ResizeDisplay(int w,int h); void OSD_CaptureInput(int cap); // sets the console version string -void OSD_SetVersionString(const char *version); +void OSD_SetVersionString(const char *version, int shade, int pal); // shows or hides the onscreen display void OSD_ShowDisplay(int onf); diff --git a/polymer/build/src/build.c b/polymer/build/src/build.c index 6200c16b3..7d19470ac 100644 --- a/polymer/build/src/build.c +++ b/polymer/build/src/build.c @@ -90,8 +90,8 @@ short brightness = 0; long zlock = 0x7fffffff, zmode = 0, whitecol, kensplayerheight = 32; short defaultspritecstat = 0; -static short localartfreq[MAXTILES]; -static short localartlookup[MAXTILES], localartlookupnum; +short localartfreq[MAXTILES]; +short localartlookup[MAXTILES], localartlookupnum; char tempbuf[4096]; diff --git a/polymer/build/src/osd.c b/polymer/build/src/osd.c index 9fb18625a..2f319f216 100644 --- a/polymer/build/src/osd.c +++ b/polymer/build/src/osd.c @@ -44,6 +44,8 @@ static void _internal_onshowosd(int); static char osdtext[TEXTSIZE]; static char osdversionstring[32]; static int osdversionstringlen; +static int osdversionstringshade; +static int osdversionstringpal; static int osdpos=0; // position next character will be written at static int osdlines=1; // # lines of text in the buffer static int osdrows=20; // # lines of the buffer that are visible @@ -773,7 +775,7 @@ void OSD_Draw(void) clearbackground(osdcols,osdrowscur+1); if (osdversionstring[0]) - drawosdstr(osdcols-osdversionstringlen,osdrowscur,osdversionstring,osdversionstringlen,0,2); + drawosdstr(osdcols-osdversionstringlen,osdrowscur,osdversionstring,osdversionstringlen,osdversionstringshade,osdversionstringpal); for (; lines>0; lines--, row--) { drawosdstr(0,row,osdtext+topoffs,osdcols,osdtextshade,osdtextpal); @@ -1051,12 +1053,14 @@ int OSD_RegisterFunction(const char *name, const char *help, int (*func)(const o // // OSD_SetVersionString() // -void OSD_SetVersionString(const char *version) +void OSD_SetVersionString(const char *version, int shade, int pal) { if (!osdinited) OSD_Init(); - strcpy(osdversionstring,version); - osdversionstringlen = strlen(osdversionstring); + Bstrcpy(osdversionstring,version); + osdversionstringlen = Bstrlen(osdversionstring); + osdversionstringshade = shade; + osdversionstringpal = pal; } // diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 063d90a80..a091b2c1f 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "types.h" #include "keyboard.h" #include "scriptfile.h" +#include "crc32.h" #define VERSION " 1.1.0 svn" @@ -56,91 +57,96 @@ static struct strllist *CommandPaths = NULL; #define MAXHELP2D (signed int)(sizeof(Help2d)/sizeof(Help2d[0])) -static char *Help2d[]= { - " 'A = Autosave toggle", - " 'J = Jump to location", - " 'L = Adjust sprite/wall coords", - " 'S = Sprite size", - " '3 = Caption mode", - " '7 = Swap tags", - " 'F = Special functions", - " X = Horiz. flip selected sects", - " Y = Vert. flip selected sects", - " F5 = Item count", - " F6 = Actor count/SE help", - " F7 = Edit sector", - " F8 = Edit wall/sprite", - " F9 = Sector tag help", - " Ctrl-S = Quick save", - " Alt-F7 = Search sector lotag", - " Alt-F8 = Search wall/sprite tags", - " [ = Search forward", - " ] = Search backward", - }; +static char *Help2d[]= + { + " 'A = Autosave toggle", + " 'J = Jump to location", + " 'L = Adjust sprite/wall coords", + " 'S = Sprite size", + " '3 = Caption mode", + " '7 = Swap tags", + " 'F = Special functions", + " X = Horiz. flip selected sects", + " Y = Vert. flip selected sects", + " F5 = Item count", + " F6 = Actor count/SE help", + " F7 = Edit sector", + " F8 = Edit wall/sprite", + " F9 = Sector tag help", + " Ctrl-S = Quick save", + " Alt-F7 = Search sector lotag", + " Alt-F8 = Search wall/sprite tags", + " [ = Search forward", + " ] = Search backward", + }; -static char *SpriteMode[]= { - "NONE", - "SECTORS", - "WALLS", - "SPRITES", - "ALL", - "ITEMS ONLY", - "CURRENT SPRITE ONLY", - "ONLY SECTOREFFECTORS AND SECTORS", - "NO SECTOREFFECTORS OR SECTORS" - }; +static char *SpriteMode[]= + { + "NONE", + "SECTORS", + "WALLS", + "SPRITES", + "ALL", + "ITEMS ONLY", + "CURRENT SPRITE ONLY", + "ONLY SECTOREFFECTORS AND SECTORS", + "NO SECTOREFFECTORS OR SECTORS" + }; #define MAXSKILL 5 -static char *SKILLMODE[MAXSKILL]= { - "Actor skill display: PIECE OF CAKE", - "Actor skill display: LET'S ROCK", - "Actor skill display: COME GET SOME", - "Actor skill display: DAMN I'M GOOD", - "Actor skill display: ALL SKILL LEVELS" - }; +static char *SKILLMODE[MAXSKILL]= + { + "Actor skill display: PIECE OF CAKE", + "Actor skill display: LET'S ROCK", + "Actor skill display: COME GET SOME", + "Actor skill display: DAMN I'M GOOD", + "Actor skill display: ALL SKILL LEVELS" + }; #define MAXNOSPRITES 4 -static char *SPRDSPMODE[MAXNOSPRITES]= { - "Sprite display: DISPLAY ALL SPRITES", - "Sprite display: NO EFFECTORS", - "Sprite display: NO ACTORS", - "Sprite display: NO EFFECTORS OR ACTORS" - }; +static char *SPRDSPMODE[MAXNOSPRITES]= + { + "Sprite display: DISPLAY ALL SPRITES", + "Sprite display: NO EFFECTORS", + "Sprite display: NO ACTORS", + "Sprite display: NO EFFECTORS OR ACTORS" + }; #define MAXHELP3D (signed int)(sizeof(Help3d)/sizeof(Help3d[0])) -static char *Help3d[]= { - "Mapster32 3D mode help", - " ", - " F1 = TOGGLE THIS HELP DISPLAY", - " F2 = TOGGLE CLIPBOARD", - " F3 = MOUSELOOK", - " F6 = AUTOMATIC SECTOREFFECTOR HELP", - " F7 = AUTOMATIC SECTOR TAG HELP", - "", - " ' A = TOGGLE AUTOSAVE", - " ' D = CYCLE SPRITE SKILL DISPLAY", - " ' G = TOGGLE CLIPBOARD GRAPHIC DISPLAY", - " ' R = TOGGLE FRAMERATE DISPLAY", - " ' W = TOGGLE SPRITE DISPLAY", - " ' X = SPRITE SHADE PREVIEW", - " ' Y = TOGGLE PURPLE BACKGROUND", - "", - " ' T = CHANGE LOTAG", - " ' H = CHANGE HITAG", - " ' S = CHANGE SHADE", - " ' M = CHANGE EXTRA", - " ' V = CHANGE VISIBILITY", - " ' L = CHANGE OBJECT COORDINATES", - " ' C = CHANGE GLOBAL SHADE", - "", - " ' ENTER = PASTE GRAPHIC ONLY", - " ' P & ; P = PASTE PALETTE TO ALL SELECTED SECTORS", - " ; V = SET VISIBILITY ON ALL SELECTED SECTORS", - " ' DEL = CSTAT=0", - " CTRL-S = SAVE BOARD", - " HOME = PGUP/PGDN MODIFIER (256 UNITS)", - " END = PGUP/PGDN MODIFIER (512 UNITS)", - }; +static char *Help3d[]= + { + "Mapster32 3D mode help", + " ", + " F1 = TOGGLE THIS HELP DISPLAY", + " F2 = TOGGLE CLIPBOARD", + " F3 = MOUSELOOK", + " F6 = AUTOMATIC SECTOREFFECTOR HELP", + " F7 = AUTOMATIC SECTOR TAG HELP", + "", + " ' A = TOGGLE AUTOSAVE", + " ' D = CYCLE SPRITE SKILL DISPLAY", + " ' G = TOGGLE CLIPBOARD GRAPHIC DISPLAY", + " ' R = TOGGLE FRAMERATE DISPLAY", + " ' W = TOGGLE SPRITE DISPLAY", + " ' X = SPRITE SHADE PREVIEW", + " ' Y = TOGGLE PURPLE BACKGROUND", + "", + " ' T = CHANGE LOTAG", + " ' H = CHANGE HITAG", + " ' S = CHANGE SHADE", + " ' M = CHANGE EXTRA", + " ' V = CHANGE VISIBILITY", + " ' L = CHANGE OBJECT COORDINATES", + " ' C = CHANGE GLOBAL SHADE", + "", + " ' ENTER = PASTE GRAPHIC ONLY", + " ' P & ; P = PASTE PALETTE TO ALL SELECTED SECTORS", + " ; V = SET VISIBILITY ON ALL SELECTED SECTORS", + " ' DEL = CSTAT=0", + " CTRL-S = SAVE BOARD", + " HOME = PGUP/PGDN MODIFIER (256 UNITS)", + " END = PGUP/PGDN MODIFIER (512 UNITS)", + }; static CACHE1D_FIND_REC *finddirs=NULL, *findfiles=NULL, *finddirshigh=NULL, *findfileshigh=NULL; static int numdirs=0, numfiles=0; @@ -1671,10 +1677,718 @@ static int AskIfSure(void) return(retval); } +static long IsValidTile(const long idTile) +{ + long bValid = 0; + + if ((idTile >= 0) && (idTile < MAXTILES)) + { + if ((tilesizx[idTile] != 0) && (tilesizy[idTile] != 0)) + { + bValid = 1; + } + } + + return bValid; +} + +static long SelectAllTiles(long iCurrentTile) +{ + long i; + + if (iCurrentTile < localartlookupnum) + { + iCurrentTile = localartlookup[iCurrentTile]; + } + else + { + iCurrentTile = 0; + } + + localartlookupnum = MAXTILES; + + for (i = 0; i < MAXTILES; i++) + { + localartlookup[i] = i; + localartfreq[i] = 0; + } + + return iCurrentTile; +} + +static long OnGotoTile(long iTile); +static long OnSelectTile(long iTile); + + +static long DrawTiles(long iTopLeft, long iSelected, long nXTiles, long nYTiles, long TileDim); + + +static long m32gettile(long idInitialTile) +{ + static long s_Zoom = INITIAL_ZOOM; + long gap, temp; + long nXTiles, nYTiles, nDisplayedTiles; + long i; + long iTile, iTopLeftTile; + long idSelectedTile; + long j; + char ch, szTemp[128]; + + +// Enable following line for testing. I couldn't work out how to change vidmode on the fly +// s_Zoom = NUM_ZOOMS - 1; + + if (idInitialTile < 0) + { + idInitialTile = 0; + } + else if (idInitialTile >= MAXTILES) + { + idInitialTile = MAXTILES - 1; + } + + // Ensure zoom not to big (which can happen if display size + // changes whilst Mapster is running) + do + { + nXTiles = xdim / ZoomToThumbSize[s_Zoom]; + nYTiles = ydim / ZoomToThumbSize[s_Zoom]; + nDisplayedTiles = nXTiles * nYTiles; + + if (0 == nDisplayedTiles) + { + // Eh-up, resolution changed since we were last displaying tiles. + s_Zoom--; + } + } + while (0 == nDisplayedTiles) ; + + keystatus[0x2F] = 0; + + for (i = 0; i < MAXTILES; i++) + { + localartfreq[i] = 0; + + localartlookup[i] = i; + } + + iTile = idSelectedTile = idInitialTile; + + switch (searchstat) + { + case 0 : + for (i = 0; i < numwalls; i++) + { + localartfreq[ wall[i].picnum ]++; + } + break; + + case 1 : + case 2 : + for (i = 0; i < numsectors; i++) + { + localartfreq[ sector[i].ceilingpicnum ]++; + localartfreq[ sector[i].floorpicnum ]++; + } + break; + + case 3 : + for (i=0;i= 0)) + { + long templong; + + templong = localartfreq[temp]; + localartfreq[temp] = localartfreq[temp+gap]; + localartfreq[temp+gap] = templong; + + templong = localartlookup[temp]; + localartlookup[temp] = localartlookup[temp+gap]; + localartlookup[temp+gap] = templong; + + if (iTile == temp) + { + iTile = temp + gap; + } + else if (iTile == temp + gap) + { + iTile = temp; + } + + temp -= gap; + } + } + gap >>= 1; + } + while (gap > 0); + + // + // Set up count of number of used tiles + // + + localartlookupnum = 0; + while (localartfreq[localartlookupnum] > 0) + { + localartlookupnum++; + } + + // + // Check : If no tiles used at all then switch to displaying all tiles + // + + if (0 == localartfreq[0]) + { + localartlookupnum = MAXTILES; + + for (i = 0; i < MAXTILES; i++) + { + localartlookup[i] = i; + localartfreq[i] = 0; // Terrible bodge : zero tilefreq's not displayed in tile view. Still, when in Rome ... :-) + } + + iTile = idInitialTile; + } + + // + // + // + + iTopLeftTile = iTile - (iTile % nXTiles); + + if (iTopLeftTile < 0) + { + iTopLeftTile = 0; + } + + if (iTopLeftTile > MAXTILES-nDisplayedTiles) + { + iTopLeftTile = MAXTILES-nDisplayedTiles; + } + + + + //////////////////////////////// + // Start of key handling code // + //////////////////////////////// + + while ((keystatus[0x1c]|keystatus[1]) == 0) // <- Presumably one of these is escape key ??? + { + DrawTiles(iTopLeftTile, iTile, nXTiles, nYTiles, ZoomToThumbSize[s_Zoom]); + + if (handleevents()) + { + if (quitevent) quitevent = 0; + } + + // These two lines are so obvious I don't need to comment them ...;-) + synctics = totalclock-lockclock; + lockclock += synctics; + + // Zoom in / out using numeric key pad's / and * keys + if (((keystatus[0xb5] > 0) && ((unsigned)s_Zoom < NUM_ZOOMS-1)) + || ((keystatus[0x37] > 0) && (s_Zoom > 0))) + { + if (keystatus[0xb5]) + { + keystatus[0xb5] = 0; + + // Watch out : If editor window is small, then the next zoom level + // might get so large that even one tile might not fit ! + if ((ZoomToThumbSize[s_Zoom+1] <= xdim) + && (ZoomToThumbSize[s_Zoom+1] <= ydim)) + { + // Phew, plenty of room. + s_Zoom++; + } + } + else + { + keystatus[0x37] = 0; + s_Zoom--; + } + + // Calculate new num of tiles to display + nXTiles = xdim / ZoomToThumbSize[s_Zoom]; + nYTiles = ydim / ZoomToThumbSize[s_Zoom]; + nDisplayedTiles = nXTiles * nYTiles; + + // Determine if the top-left displayed tile needs to + // alter in order to display selected tile + iTopLeftTile = iTile - (iTile % nXTiles); + + if (iTopLeftTile < 0) + { + iTopLeftTile = 0; + } + else if (iTopLeftTile > MAXTILES - nDisplayedTiles) + { + iTopLeftTile = MAXTILES - nDisplayedTiles; + } + + } + + // LEFT KEYPRESS + if (keystatus[0xcb] > 0) + { + iTile -= (iTile > 0); + keystatus[0xcb] = 0; + } + + // RIGHT KEYPRESS + if (keystatus[0xcd] > 0) + { + iTile += (iTile < MAXTILES); + keystatus[0xcd] = 0; + } + + // UP KEYPRESS + if (keystatus[0xc8] > 0) + { + iTile -= nXTiles; + keystatus[0xc8] = 0; + } + + // DOWN KEYPRESS + if (keystatus[0xd0] > 0) + { + iTile += nXTiles; + keystatus[0xd0] = 0; + } + + // PGUP KEYPRESS + if (keystatus[0xc9] > 0) + { + iTile -= nDisplayedTiles; + keystatus[0xc9] = 0; + } + + // PGDOWN KEYPRESS + if (keystatus[0xd1] > 0) + { + iTile += nDisplayedTiles; + keystatus[0xd1] = 0; + } + + // + // Ensure tilenum is within valid range + // + + while (iTile < 0) + { + iTile += nXTiles; + } + + while (iTile >= MAXTILES) // shouldn't this be the count of num tiles ??? + { + iTile -= nXTiles; + } + + // 'V' KEYPRESS + if (keystatus[0x2f] > 0) + { + keystatus[0x2f] = 0; + + iTile = SelectAllTiles(iTile); + } + + // 'G' KEYPRESS - Goto frame + if (keystatus[0x22] > 0) + { + keystatus[0x22] = 0; + + iTile = OnGotoTile(iTile); + } + + // 'U' KEYPRESS : go straight to user defined art + if (keystatus[0x16]) + { + SelectAllTiles(iTile); + + iTile = FIRST_USER_ART_TILE; + } + + // 'A' KEYPRESS : Go straight to start of Atomic edition's art + if (keystatus[0x1E]) + { + SelectAllTiles(iTile); + + iTile = FIRST_ATOMIC_TILE; + } + + // 'T' KEYPRESS = Select from pre-defined tileset + if (keystatus[0x14]) + { + keystatus[0x14] = 0; + + iTile = OnSelectTile(iTile); + } + + // + // Adjust top-left to ensure tilenum is within displayed range of tiles + // + + while (iTile < iTopLeftTile) + { + iTopLeftTile -= nXTiles; + } + + while (iTile >= iTopLeftTile + nDisplayedTiles) + { + iTopLeftTile += nXTiles; + } + + if (iTopLeftTile < 0) + { + iTopLeftTile = 0; + } + + if (iTopLeftTile > MAXTILES - nDisplayedTiles) + { + iTopLeftTile = MAXTILES - nDisplayedTiles; + } + + if (keystatus[0x1c] == 0) // uh ? Not escape key ? + { + idSelectedTile = idInitialTile; + } + else + { + if (iTile < localartlookupnum) + { + // Convert tile num from index to actual tile num + idSelectedTile = localartlookup[iTile]; + + // Check : if invalid tile selected, return original tile num + if (!IsValidTile(idSelectedTile)) + { + idSelectedTile = idInitialTile; + } + } + else + { + idSelectedTile = idInitialTile; + } + } + } + + keystatus[0x1] = 0; + keystatus[0x1c] = 0; + + return(idSelectedTile); + +} + +// Dir = 0 (zoom out) or 1 (zoom in) +//void OnZoomInOut( long *pZoom, long Dir /*0*/ ) +//{ +//} + +static long OnGotoTile(long iTile) +{ + long iTemp, iNewTile; + char ch; + char szTemp[128]; + + //Automatically press 'V' + iTile = SelectAllTiles(iTile); + + bflushchars(); + + iNewTile = iTemp = iTile; + + while (keystatus[1] == 0) + { + if (handleevents()) + { + if (quitevent) quitevent = 0; + } + + ch = bgetchar(); + + Bsprintf(szTemp, "Goto tile: %ld_ ", iNewTile); + printext256(0, 0, whitecol, 0, szTemp, 0); + showframe(1); + + if (ch >= '0' && ch <= '9') + { + iTemp = (iNewTile*10) + (ch-'0'); + if (iTemp < MAXTILES) + { + iNewTile = iTemp; + } + } + else if (ch == 8) + { + iNewTile /= 10; + } + else if (ch == 13) + { + iTile = iNewTile; + break; + } + } + + clearkeys(); + + return iTile; +} + +static long LoadTileSet(const long idCurrentTile, const long *pIds, const long nIds) +{ + long iNewTile = 0; + long i; + + localartlookupnum = nIds; + + for (i = 0; i < localartlookupnum; i++) + { + localartlookup[i] = pIds[i]; + // REM : Could we still utilise localartfreq[] to mark + // which tiles are currently used in the map ? Set to 0xFFFF perhaps ? + localartfreq[i] = 0; + + if (idCurrentTile == pIds[i]) + { + iNewTile = i; + } + } + + return iNewTile; + +} + +static long OnSelectTile(long iTile) +{ + long bDone = 0; + long i, j; + char ch; + + SelectAllTiles(iTile); + + bflushchars(); + + begindrawing(); + setpolymost2dview(); + clearview(0); + + // + // Display the description strings for each available tile group + // + + for (i = 0; (unsigned)i < NUM_TILE_GROUPS; i++) + { + printext256(10L, (i+1)*16, whitecol, -1, s_TileGroups[i].szText, 0); + } + showframe(1); + + // + // Await appropriate selection keypress. + // + + bDone = 0; + + while (keystatus[1] == 0 && (0 == bDone)) + { + if (handleevents()) + { + if (quitevent) quitevent = 0; + } + + ch = bgetchar(); + + for (i = 0; (unsigned)i < NUM_TILE_GROUPS; i++) + { + if ((ch == s_TileGroups[i].key1) || (ch == s_TileGroups[i].key2)) + { + iTile = LoadTileSet(iTile, s_TileGroups[i].pIds, s_TileGroups[i].nIds); + bDone = 1; + } + } + } + + enddrawing(); + showframe(1); + + clearkeys(); + + return iTile; +} + +const char * GetTilePixels(const long idTile) +{ + char *pPixelData = 0; + + if ((idTile >= 0) && (idTile < MAXTILES)) + { + if (0 == waloff[idTile]) + { + loadtile(idTile); + } + + if (IsValidTile(idTile)) + { + pPixelData = (char *)waloff[idTile]; + } + } + + return pPixelData; +} + +#define PIXELS_PER_DISPLAY_LINE ylookup[1] + +static long DrawTiles(long iTopLeft, long iSelected, long nXTiles, long nYTiles, long TileDim) +{ + long XTile, YTile; + long iTile, idTile; + long XBox, YBox; + long XPos, YPos; + long XOffset, YOffset; + long i; + const char * pRawPixels; + long TileSizeX, TileSizeY; + long DivInc,MulInc; + char *pScreen; + char szT[128]; + + begindrawing(); + + setpolymost2dview(); + + clearview(0); + + for (YTile = 0; YTile < nYTiles; YTile++) + { + for (XTile = 0; XTile < nXTiles; XTile++) + { + iTile = iTopLeft + XTile + (YTile * nXTiles); + + if (iTile < localartlookupnum) + { + idTile = localartlookup[ iTile ]; + + // Get pointer to tile's raw pixel data + pRawPixels = GetTilePixels(idTile); + + if (pRawPixels != NULL) + { + XPos = XTile * TileDim; + YPos = YTile * TileDim; + + if (polymost_drawtilescreen(XPos, YPos, idTile, TileDim)) + { + TileSizeX = tilesizx[ idTile ]; + TileSizeY = tilesizy[ idTile ]; + + DivInc = 1; + MulInc = 1; + + while ((TileSizeX/DivInc > TileDim) + || (TileSizeY/DivInc) > TileDim) + { + DivInc++; + } + + if (1 == DivInc) + { + while (((TileSizeX*(MulInc+1)) <= TileDim) + && ((TileSizeY*(MulInc+1)) <= TileDim)) + { + MulInc++; + } + } + + TileSizeX = (TileSizeX / DivInc) * MulInc; + TileSizeY = (TileSizeY / DivInc) * MulInc; + + pScreen = (char *)ylookup[YPos]+XPos+frameplace; + + for (YOffset = 0; YOffset < TileSizeY; YOffset++) + { + for (XOffset = 0; XOffset < TileSizeX; XOffset++) + { + pScreen[XOffset] = pRawPixels[((YOffset * DivInc) / MulInc) + (((XOffset * DivInc) / MulInc) * tilesizy[idTile])]; + } + + pScreen += PIXELS_PER_DISPLAY_LINE; + } + } + if (localartfreq[iTile] != 0) + { + Bsprintf(szT, "%d", localartfreq[iTile]); + printext256(XPos, YPos, whitecol, -1, szT, 1); + } + } + } + } + } + + // + // Draw white box around currently selected tile + // + + XBox = (iSelected % nXTiles) * TileDim; + YBox = ((iSelected - (iSelected % nXTiles) - iTopLeft) / nXTiles) * TileDim; + + for (i = 0; i < TileDim; i++) + { + plotpixel(XBox+i, YBox, whitecol); + plotpixel(XBox+i, YBox + TileDim, whitecol); + plotpixel(XBox, YBox + i, whitecol); + plotpixel(XBox + TileDim, YBox + i, whitecol); + } + + idTile = localartlookup[ iSelected ]; + + Bsprintf(szT, "%ld" , idTile); + printext256(0L, ydim-8, whitecol, -1, szT, 0); + printext256(xdim-(Bstrlen(names[idTile])<<3),ydim-8,whitecol,-1,names[idTile],0); + + Bsprintf(szT,"%dx%d",tilesizx[idTile],tilesizy[idTile]); + printext256(xdim>>2,ydim-8,whitecol,-1,szT,0); + + enddrawing(); + showframe(1); + + return(0); + +} + static void Keys3d(void) { long i,count,rate,nexti; - long j, k, templong, changedir, hiz, loz; + long j, k, templong = 0, changedir, hiz, loz; long hitx, hity, hitz, hihit, lohit; long repeatcountx=0,repeatcounty=0; char smooshyalign=0, repeatpanalign=0, buffer[80]; @@ -1797,6 +2511,28 @@ static void Keys3d(void) } } + if (keystatus[0x2f] > 0) //V + { + if (searchstat == 0) templong = wall[searchwall].picnum; + if (searchstat == 1) templong = sector[searchsector].ceilingpicnum; + if (searchstat == 2) templong = sector[searchsector].floorpicnum; + if (searchstat == 3) templong = sprite[searchwall].picnum; + if (searchstat == 4) templong = wall[searchwall].overpicnum; + templong = m32gettile(templong); + if (searchstat == 0) wall[searchwall].picnum = templong; + if (searchstat == 1) sector[searchsector].ceilingpicnum = templong; + if (searchstat == 2) sector[searchsector].floorpicnum = templong; + if (searchstat == 3) sprite[searchwall].picnum = templong; + if (searchstat == 4) + { + wall[searchwall].overpicnum = templong; + if (wall[searchwall].nextwall >= 0) + wall[wall[searchwall].nextwall].overpicnum = templong; + } + asksave = 1; + keystatus[0x2f] = 0; + } + if (keystatus[0x04] > 0) /* 3 (toggle floor-over-floor (cduke3d only) */ { floor_over_floor = !floor_over_floor; @@ -4372,7 +5108,7 @@ int ExtPreInit(int argc,char **argv) wm_setapptitle("Mapster32"VERSION); OSD_SetLogFile("mapster32.log"); - OSD_SetVersionString("Mapster32"VERSION); + OSD_SetVersionString("Mapster32"VERSION,0,2); initprintf("Mapster32"VERSION" ("__DATE__" "__TIME__")\n"); initprintf("Copyright (c) 2007 EDuke32 team\n\n"); @@ -4415,6 +5151,277 @@ static int osdcmd_editorgridextent(const osdfuncparm_t *parm) return OSDCMD_OK; } +static int osdcmd_addpath(const osdfuncparm_t *parm) +{ + char pathname[BMAX_PATH]; + + if (parm->numparms != 1) return OSDCMD_SHOWHELP; + + strcpy(pathname,parm->parms[0]); + addsearchpath(pathname); + return OSDCMD_OK; +} + +static int osdcmd_initgroupfile(const osdfuncparm_t *parm) +{ + char file[BMAX_PATH]; + + if (parm->numparms != 1) return OSDCMD_SHOWHELP; + + strcpy(file,parm->parms[0]); + initgroupfile(file); + return OSDCMD_OK; +} + +static int osdcmd_echo(const osdfuncparm_t *parm) +{ + int i; + for (i = 0; i < parm->numparms; i++) + { + if (i > 0) OSD_Printf(" "); + OSD_Printf("%s", parm->parms[i]); + } + OSD_Printf("\n"); + + return OSDCMD_OK; +} + +static int osdcmd_fileinfo(const osdfuncparm_t *parm) +{ + unsigned long crc, length; + int i,j; + char buf[256]; + + if (parm->numparms != 1) return OSDCMD_SHOWHELP; + + if ((i = kopen4load((char *)parm->parms[0],0)) < 0) + { + OSD_Printf("fileinfo: File \"%s\" not found.\n", parm->parms[0]); + return OSDCMD_OK; + } + + length = kfilelength(i); + + crc32init(&crc); + do + { + j = kread(i,buf,256); + crc32block(&crc,(unsigned char *)buf,j); + } + while (j == 256); + crc32finish(&crc); + + kclose(i); + + OSD_Printf("fileinfo: %s\n" + " File size: %d\n" + " CRC-32: %08X\n", + parm->parms[0], length, crc); + + return OSDCMD_OK; +} + +static int osdcmd_sensitivity(const osdfuncparm_t *parm) +{ + if (parm->numparms != 1) + { + OSD_Printf("\"sensitivity\" is \"%.2f\"\n",msens); + return OSDCMD_SHOWHELP; + } + msens = atof(parm->parms[0]); + OSD_Printf("sensitivity %.2f\n",msens); + return OSDCMD_OK; +} + +static int osdcmd_gamma(const osdfuncparm_t *parm) +{ + extern short brightness; + + if (parm->numparms != 1) + { + OSD_Printf("\"gamma\" \"%d\"\n",brightness); + return OSDCMD_SHOWHELP; + } + brightness = atoi(parm->parms[0]); + setbrightness(brightness,palette,0); + OSD_Printf("gamma %d\n",brightness); + return OSDCMD_OK; +} + +static int load_script(const char *szScript) +{ + FILE* fp = fopenfrompath(szScript, "r"); + + if (fp != NULL) + { + char line[255]; + + OSD_Printf("Executing \"%s\"\n", szScript); + while (fgets(line ,sizeof(line)-1, fp) != NULL) + OSD_Dispatch(strtok(line,"\r\n")); + fclose(fp); + return 0; + } + return 1; +} + +static int osdcmd_exec(const osdfuncparm_t *parm) +{ + char fn[BMAX_PATH]; + + if (parm->numparms != 1) return OSDCMD_SHOWHELP; + Bstrcpy(fn,parm->parms[0]); + + if (load_script(fn)) + { + OSD_Printf("exec: file \"%s\" not found.\n", fn); + return OSDCMD_OK; + } + return OSDCMD_OK; +} + +static int osdcmd_noclip(const osdfuncparm_t *parm) +{ + noclip = !noclip; + + return OSDCMD_OK; +} + +static int registerosdcommands(void) +{ + OSD_RegisterFunction("addpath","addpath : adds path to game filesystem", osdcmd_addpath); + + OSD_RegisterFunction("echo","echo [text]: echoes text to the console", osdcmd_echo); + OSD_RegisterFunction("editorgridextent","editorgridextent: sets the size of the 2D mode editing grid",osdcmd_editorgridextent); + OSD_RegisterFunction("exec","exec : executes a script", osdcmd_exec); + + OSD_RegisterFunction("fileinfo","fileinfo : gets a file's information", osdcmd_fileinfo); + + OSD_RegisterFunction("gamma","gamma : changes brightness", osdcmd_gamma); + + OSD_RegisterFunction("initgroupfile","initgroupfile : adds a grp file into the game filesystem", osdcmd_initgroupfile); + + OSD_RegisterFunction("noclip","noclip: toggles clipping mode", osdcmd_noclip); + + OSD_RegisterFunction("quit","quit: exits the game immediately", osdcmd_quit); + + OSD_RegisterFunction("sensitivity","sensitivity : changes the mouse sensitivity", osdcmd_sensitivity); + + return 0; +} + +#ifdef DUKEOSD +void GAME_drawosdchar(int x, int y, char ch, int shade, int pal) +{ + int ac; + + if (ch == 32) return; + ac = ch-'!'+STARTALPHANUM; + if (ac < STARTALPHANUM || ac > ENDALPHANUM) return; + + rotatesprite(((x<<3)+x)<<16, (y<<3)<<16, 65536l, 0, ac, shade, pal, 8|16, 0, 0, xdim-1, ydim-1); +} + +void GAME_drawosdstr(int x, int y, char *ch, int len, int shade, int pal) +{ + int ac; + + for (x = (x<<3)+x; len>0; len--, ch++, x++) + { + if (*ch == 32) + { + x+=5; + continue; + } + ac = *ch-'!'+STARTALPHANUM; + if (ac < STARTALPHANUM || ac > ENDALPHANUM) return; + + rotatesprite(x<<16, (y<<3)<<16, 65536l, 0, ac, shade, pal, 8|16, 0, 0, xdim-1, ydim-1); + if (*ch >= '0' && *ch <= '9') x+=8; + else x += tilesizx[ac]; + } +} + +static long GetTime(void) +{ + return totalclock; +} + +void GAME_drawosdcursor(int x, int y, int type, int lastkeypress) +{ + int ac; + + if (type) ac = SMALLFNTCURSOR; + else ac = '_'-'!'+STARTALPHANUM; + + if (!((GetTime()-lastkeypress) & 0x40l)) + rotatesprite(((x<<3)+x)<<16, ((y<<3)+(type?-1:2))<<16, 65536l, 0, ac, 0, 8, 8|16, 0, 0, xdim-1, ydim-1); +} + +int GAME_getcolumnwidth(int w) +{ + return w/9; +} + +int GAME_getrowheight(int w) +{ + return w>>3; +} + +//#define BGTILE 311 +//#define BGTILE 1156 +#define BGTILE 1141 // BIGHOLE +#define BORDTILE 3250 // VIEWBORDER +#define BITSTH 1+32+8+16 // high translucency +#define BITSTL 1+8+16 // low translucency +#define BITS 8+16+64 // solid +#define SHADE 16 +#define PALETTE 4 +void GAME_clearbackground(int c, int r) +{ + long x, y, xsiz, ysiz, tx2, ty2; + long daydim, bits; + +#ifdef _WIN32 + if (qsetmode != 200) + { + OSD_SetFunctions( + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + (int(*)(void))GetTime, + NULL + ); + return; + } +#endif + + if (getrendermode() < 3) bits = BITS; + else bits = BITSTL; + + daydim = r<<3; + + xsiz = tilesizx[BGTILE]; + tx2 = xdim/xsiz; + ysiz = tilesizy[BGTILE]; + ty2 = daydim/ysiz; + + for (x=0;x<=tx2;x++) + for (y=0;y<=ty2;y++) + rotatesprite(x*xsiz<<16,y*ysiz<<16,65536L,0,BGTILE,SHADE,PALETTE,bits,0,0,xdim,daydim); + + xsiz = tilesizy[BORDTILE]; + tx2 = xdim/xsiz; + ysiz = tilesizx[BORDTILE]; + + for (x=0;x<=tx2;x++) + rotatesprite(x*xsiz<<16,(daydim+ysiz+1)<<16,65536L,1536,BORDTILE,SHADE-12,PALETTE,BITS,0,0,xdim,daydim+ysiz+1); +} +#endif + enum { T_EOF = -2, T_ERROR = -1, @@ -4607,7 +5614,7 @@ int ExtInit(void) if (getenv("DUKE3DDEF")) { defsfilename = getenv("DUKE3DDEF"); - initprintf("Using %s as definitions file\n", defsfilename); + initprintf("Using '%s' as definitions file\n", defsfilename); } loadgroupfiles(defsfilename); @@ -4661,8 +5668,21 @@ int ExtInit(void) Bstrcpy(apptitle, "Mapster32"VERSION""); autosavetimer = totalclock+120*180; - OSD_RegisterFunction("quit","you tried to get help on quit?",osdcmd_quit); - OSD_RegisterFunction("editorgridextent","editorgridextent: sets the size of the 2D mode editing grid",osdcmd_editorgridextent); +#if defined(_WIN32) && defined(DUKEOSD) + OSD_SetFunctions( + GAME_drawosdchar, + GAME_drawosdstr, + GAME_drawosdcursor, + GAME_getcolumnwidth, + GAME_getrowheight, + GAME_clearbackground, + (int(*)(void))GetTime, + NULL + ); +#endif + + OSD_SetParameters(0,2, 0,0, 4,0); + registerosdcommands(); return rv; } @@ -4882,6 +5902,34 @@ static void Keys2d3d(void) { getmessageleng = 0; getmessagetimeoff = 0; +#if defined(_WIN32) && defined(DUKEOSD) + if (qsetmode == 200) + { + OSD_SetFunctions( + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + (int(*)(void))GetTime, + NULL + ); + } + else + { + OSD_SetFunctions( + GAME_drawosdchar, + GAME_drawosdstr, + GAME_drawosdcursor, + GAME_getcolumnwidth, + GAME_getrowheight, + GAME_clearbackground, + (int(*)(void))GetTime, + NULL + ); + } +#endif } if (getmessageleng > 0) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 4d11cb49a..ece042606 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -102,7 +102,7 @@ extern int32 numlumps; static FILE *frecfilep = (FILE *)NULL; int restorepalette,screencapt; -static int nomorelogohack; +static int nomorelogohack, nologo = 0; static int sendmessagecommand = -1; char defaultduke3dgrp[BMAX_PATH] = "duke3d.grp"; @@ -8715,6 +8715,12 @@ static void checkcommandline(int argc,char **argv) i++; continue; } + if (!Bstrcasecmp(c+1,"nologo")) + { + nologo = 1; + i++; + continue; + } #if !defined(_WIN32) if (!Bstrcasecmp(c+1,"usecwd")) { @@ -9022,7 +9028,7 @@ static void Logo(void) MUSIC_StopSong(); FX_StopAllSounds(); // JBF 20031228 clearsoundlocks(); // JBF 20031228 - if (ud.multimode < 2 && (logoflags & LOGO_FLAG_ENABLED)) + if (ud.multimode < 2 && (logoflags & LOGO_FLAG_ENABLED) && !nologo) { if (VOLUMEALL && (logoflags & LOGO_FLAG_PLAYANIM)) { @@ -10064,7 +10070,7 @@ while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf( } if (quitevent) return; - if (!loaddefinitionsfile(duke3ddef)) initprintf("Definitions file loaded.\n"); + if (!loaddefinitionsfile(duke3ddef)) initprintf("Definitions file '%s' loaded.\n",duke3ddef); // initprintf("numplayers=%i\n",numplayers); @@ -10119,7 +10125,7 @@ while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf( GAME_onshowosd ); OSD_SetParameters(0,2, 0,0, 4,0); - OSD_SetVersionString(HEAD2); + OSD_SetVersionString(HEAD2,0,2); registerosdcommands(); if (setgamemode(ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP) < 0) diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index 878e0ae56..b87e4fda5 100755 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -28,6 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern int g_i,g_p; +static void ResetPointerVars(void); + static void FreeGameVars(void) { // call this function as many times as needed. @@ -129,6 +131,8 @@ int ReadGameVars(long fil) // else nothing 'extra...' } + ResetPointerVars(); + // Bsprintf(g_szBuf,"CP:%s %d",__FILE__,__LINE__); // AddLog(g_szBuf); if (kdfread(apScriptGameEvent,sizeof(apScriptGameEvent),1,fil) != 1) goto corrupt; @@ -1256,3 +1260,75 @@ void InitGameVarPointers(void) } } +static void ResetPointerVars(void) +{ + aGameVars[GetGameID("RESPAWN_MONSTERS")].lValue = (long)&ud.respawn_monsters; + aGameVars[GetGameID("RESPAWN_ITEMS")].lValue = (long)&ud.respawn_items; + aGameVars[GetGameID("RESPAWN_INVENTORY")].lValue = (long)&ud.respawn_inventory; + aGameVars[GetGameID("MONSTERS_OFF")].lValue = (long)&ud.monsters_off; + aGameVars[GetGameID("MARKER")].lValue = (long)&ud.marker; + aGameVars[GetGameID("FFIRE")].lValue = (long)&ud.ffire; + aGameVars[GetGameID("LEVEL")].lValue = (long)&ud.level_number; + aGameVars[GetGameID("VOLUME")].lValue = (long)&ud.volume_number; + + aGameVars[GetGameID("COOP")].lValue = (long)&ud.coop; + aGameVars[GetGameID("MULTIMODE")].lValue = (long)&ud.multimode; + + aGameVars[GetGameID("myconnectindex")].lValue = (long)&myconnectindex; + aGameVars[GetGameID("screenpeek")].lValue = (long)&screenpeek; + aGameVars[GetGameID("currentweapon")].lValue = (long)&g_currentweapon; + aGameVars[GetGameID("gs")].lValue = (long)&g_gs; + aGameVars[GetGameID("looking_arc")].lValue = (long)&g_looking_arc; + aGameVars[GetGameID("gun_pos")].lValue = (long)&g_gun_pos; + aGameVars[GetGameID("weapon_xoffset")].lValue = (long)&g_weapon_xoffset; + aGameVars[GetGameID("weaponcount")].lValue = (long)&g_kb; + aGameVars[GetGameID("looking_angSR1")].lValue = (long)&g_looking_angSR1; + aGameVars[GetGameID("xdim")].lValue = (long)&xdim; + aGameVars[GetGameID("ydim")].lValue = (long)&ydim; + aGameVars[GetGameID("windowx1")].lValue = (long)&windowx1; + aGameVars[GetGameID("windowx2")].lValue = (long)&windowx2; + aGameVars[GetGameID("windowy1")].lValue = (long)&windowy1; + aGameVars[GetGameID("windowy2")].lValue = (long)&windowy2; + aGameVars[GetGameID("totalclock")].lValue = (long)&totalclock; + aGameVars[GetGameID("lastvisinc")].lValue = (long)&lastvisinc; + aGameVars[GetGameID("numsectors")].lValue = (long)&numsectors; + aGameVars[GetGameID("numplayers")].lValue = (long)&numplayers; + aGameVars[GetGameID("viewingrange")].lValue = (long)&viewingrange; + aGameVars[GetGameID("yxaspect")].lValue = (long)&yxaspect; + aGameVars[GetGameID("gravitationalconstant")].lValue = (long)&gc; + aGameVars[GetGameID("gametype_flags")].lValue = (long)&gametype_flags[ud.coop]; + aGameVars[GetGameID("framerate")].lValue = (long)&framerate; + + aGameVars[GetGameID("camerax")].lValue = (long)&ud.camerax; + aGameVars[GetGameID("cameray")].lValue = (long)&ud.cameray; + aGameVars[GetGameID("cameraz")].lValue = (long)&ud.cameraz; + aGameVars[GetGameID("cameraang")].lValue = (long)&ud.cameraang; + aGameVars[GetGameID("camerahoriz")].lValue = (long)&ud.camerahoriz; + aGameVars[GetGameID("camerasect")].lValue = (long)&ud.camerasect; + + aGameVars[GetGameID("myx")].lValue = (long)&myx; + aGameVars[GetGameID("myy")].lValue = (long)&myy; + aGameVars[GetGameID("myz")].lValue = (long)&myz; + aGameVars[GetGameID("omyx")].lValue = (long)&omyx; + aGameVars[GetGameID("omyy")].lValue = (long)&omyy; + aGameVars[GetGameID("omyz")].lValue = (long)&omyz; + aGameVars[GetGameID("myxvel")].lValue = (long)&myxvel; + aGameVars[GetGameID("myyvel")].lValue = (long)&myyvel; + aGameVars[GetGameID("myzvel")].lValue = (long)&myzvel; + + aGameVars[GetGameID("myhoriz")].lValue = (long)&myhoriz; + aGameVars[GetGameID("myhorizoff")].lValue = (long)&myhorizoff; + aGameVars[GetGameID("omyhoriz")].lValue = (long)&omyhoriz; + aGameVars[GetGameID("omyhorizoff")].lValue = (long)&omyhorizoff; + aGameVars[GetGameID("myang")].lValue = (long)&myang; + aGameVars[GetGameID("omyang")].lValue = (long)&omyang; + aGameVars[GetGameID("mycursectnum")].lValue = (long)&mycursectnum; + aGameVars[GetGameID("myjumpingcounter")].lValue = (long)&myjumpingcounter; + + aGameVars[GetGameID("myjumpingtoggle")].lValue = (long)&myjumpingtoggle; + aGameVars[GetGameID("myonground")].lValue = (long)&myonground; + aGameVars[GetGameID("myhardlanding")].lValue = (long)&myhardlanding; + aGameVars[GetGameID("myreturntocenter")].lValue = (long)&myreturntocenter; + + aGameVars[GetGameID("display_mirror")].lValue = (long)&display_mirror; +} diff --git a/polymer/eduke32/source/mapster32.h b/polymer/eduke32/source/mapster32.h index 03800b7fd..017ab3275 100644 --- a/polymer/eduke32/source/mapster32.h +++ b/polymer/eduke32/source/mapster32.h @@ -156,3 +156,188 @@ void ResetKeys(); extern void fixspritesectors(void); #define KEY_PRESSED(sc) KB_KeyPressed((sc)) + +// REM : This file should be included in file BUILD.C _ONLY_ + +#include "names.h" + + + +// 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 + +static const long ZoomToThumbSize[] = +{ + FUCKING_GOOD_EYESIGHT, 32, 64, 128, 192, 256, 384, 512 +} ; + +#define NUM_ZOOMS (sizeof(ZoomToThumbSize)/sizeof(ZoomToThumbSize[0])) + +#define INITIAL_ZOOM 2 + + +// If I wasn't a lazy sod I'd have made these loadable from external config files. + + /////////////////// + // ACTOR SPRITES // + /////////////////// + +static const long s_idActors[] = +{ + LIZTROOP, LIZTROOPRUNNING, LIZTROOPSTAYPUT, LIZTROOPSHOOT, LIZTROOPJETPACK, + LIZTROOPONTOILET, LIZTROOPJUSTSIT, LIZTROOPDUCKING, + PIGCOP, PIGCOPSTAYPUT, PIGCOPDIVE, + LIZMAN, LIZMANSTAYPUT, LIZMANSPITTING, LIZMANFEEDING, LIZMANJUMP, + COMMANDER, COMMANDERSTAYPUT, + OCTABRAIN, OCTABRAINSTAYPUT, + ORGANTIC, + NEWBEAST, NEWBEASTSTAYPUT, NEWBEASTJUMP, + EGG, GREENSLIME, ROTATEGUN, RECON, TANK, BOUNCEMINE, + FLOORFLAME, + // FEMS + FEM1, FEM2, FEM3, FEM4, FEM5, FEM6, FEM7, FEM8, FEM9, FEM10, NAKED1, + // Lil' critters + SHARK, + // BIG critters + BOSS1, BOSS1STAYPUT, BOSS1SHOOT, BOSS1LOB, + BOSS2, + BOSS3, + BOSS4, BOSS4STAYPUT +} ; + +#define NUM_ACTORS (sizeof(s_idActors)/sizeof(s_idActors[0])) + + ///////////////// + // DOOR TILES /// + ///////////////// + +// Not all of these are tuely door tiles but are useable as such + +static const long s_idDoors[] = +{ + DOORTILE1, DOORTILE2, DOORTILE3, DOORTILE4, DOORTILE5, + DOORTILE6, DOORTILE7, DOORTILE8, DOORTILE9, DOORTILE10, + 312, 313, 314, 345, + DOORTILE22, DOORTILE18, DOORTILE19, DOORTILE20, + 450, 455, 457, 458, 459, 469, 470, 477, + DOORTILE14, + 719, 735, 771, + DOORTILE16, + 843, 858, 883, + DOORTILE15, DOORTILE21, + 1173, + DOORTILE11,DOORTILE12, + 353, 355, + // Related items + DOORSHOCK, ACCESSCARD +}; + +#define NUM_DOORS (sizeof(s_idDoors)/sizeof(s_idDoors[0])) + + ////////////////// + // SWITCH TILES // + ////////////////// + +static const long s_idSwitches[] = +{ + ACCESSSWITCH,ACCESSSWITCH2, SLOTDOOR, LIGHTSWITCH, SPACEDOORSWITCH, SPACELIGHTSWITCH, + FRANKENSTINESWITCH, MULTISWITCH, + DIPSWITCH, DIPSWITCH2, DIPSWITCH3, TECHSWITCH, + LIGHTSWITCH2, LIGHTSWITCH2+1, + POWERSWITCH1, LOCKSWITCH1, POWERSWITCH2, HANDSWITCH, PULLSWITCH, + ALIENSWITCH, HANDPRINTSWITCH, NUKEBUTTON, + TARGET, + 4083, 4954 // Busted switches (Atomic) +} ; + +#define NUM_SWITCHES (sizeof(s_idSwitches)/sizeof(s_idSwitches[0])) + + /////////////////// + // GOODIES TILES // + /////////////////// + +static const long s_idGoodies[] = +{ + // Ammo + AMMO,SHOTGUNAMMO, BATTERYAMMO, RPGAMMO, HEAVYHBOMB, FREEZEAMMO, GROWAMMO, CRYSTALAMMO, + DEVISTATORAMMO, HBOMBAMMO, + + // Items (health,etc) + COLA, SIXPAK, FIRSTAID, SHIELD, STEROIDS, AIRTANK, JETPACK, HEATSENSOR, ACCESSCARD, + BOOTS, ATOMICHEALTH, + + // Weapons + FIRSTGUNSPRITE, CHAINGUNSPRITE, RPGSPRITE, FREEZESPRITE, SHRINKERSPRITE, + TRIPBOMBSPRITE, SHOTGUNSPRITE, DEVISTATORSPRITE + +} ; + +#define NUM_GOODIES (sizeof(s_idGoodies)/sizeof(s_idGoodies[0])) + + //////////////////////// + // ITEMS THAT RESPAWN // + //////////////////////// + +// Thought there were more than just these :-( + +static const long s_idRespawns[] = +{ + CANWITHSOMETHING, CANWITHSOMETHING2, CANWITHSOMETHING3, CANWITHSOMETHING4, + // FEMS + FEM1, FEM2, FEM3, FEM4, FEM5, FEM6, FEM7, FEM8, FEM9, FEM10, NAKED1, +} ; + +#define NUM_RESPAWNS (sizeof(s_idRespawns)/sizeof(s_idRespawns[0])) + + //////////////////////// + // EXPLOSION AND FIRE // + //////////////////////// + +static const long s_idExplosions[] = +{ + CRACK1, CRACK2, CRACK3, CRACK4, + FIREEXT, SEENINE, OOZFILTER, + EXPLODINGBARREL, EXPLODINGBARREL2, FIREBARREL, GUNPOWDERBARREL, + REACTOR2SPARK, BOLT1, SIDEBOLT1, + CEILINGSTEAM, + FIREVASE, 2066, BURNING, FIRE, BURNING2, FIRE2 +} ; + +#define NUM_EXPLOSIONS (sizeof(s_idExplosions)/sizeof(s_idExplosions[0])) + + //////////////////////////////////////////////////////////////// + // BUILD STRUCTURE USED IN SELECTING ONE OF ABOVE LTILE LISTS // + //////////////////////////////////////////////////////////////// + +const struct +{ + const long *pIds ; // ptr to list of tile Ids + long nIds ; // num of tile ids + 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 *szText ; // description to present to user. +} s_TileGroups[] = +{ + { s_idActors, NUM_ACTORS, 'A', 'a', "(A) Actor group" }, + { s_idDoors, NUM_DOORS, 'D', 'd', "(D) Door group" }, + { s_idGoodies, NUM_GOODIES, 'G', 'g', "(G) Goodies (ammo, weapons, etc)" }, + { s_idRespawns, NUM_RESPAWNS, 'R', 'r', "(R) Respawning Items" }, + { s_idSwitches, NUM_SWITCHES, 'S', 's', "(S) Switch group" }, + { s_idExplosions, NUM_EXPLOSIONS, 'X', 'x', "(X) eXplosions, fire, sparks, etc" } +} ; + +#define NUM_TILE_GROUPS (sizeof(s_TileGroups)/sizeof(s_TileGroups[0])) + + +#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 + +extern short localartfreq[MAXTILES]; +extern short localartlookup[MAXTILES], localartlookupnum; +extern long lockclock; +extern void clearkeys(void);