mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Fix building with Watcom and move the KenBuild test game stuff out of the engine source
git-svn-id: https://svn.eduke32.com/eduke32@201 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
50474b8e5a
commit
504cbf9b88
36 changed files with 8554 additions and 8552 deletions
|
@ -35,6 +35,7 @@ FMODROOTWIN=c:/sdks/fmodapi374win/api
|
|||
# build locations - OBJ gets overridden to the game-specific objects dir
|
||||
OBJ?=obj.gnu/
|
||||
SRC=src/
|
||||
GAME=game/
|
||||
RSRC=rsrc/
|
||||
INC=include/
|
||||
|
||||
|
@ -60,8 +61,9 @@ AR=ar
|
|||
RANLIB=ranlib
|
||||
OURCFLAGS=$(debug) -W -Wall -Wimplicit -Wno-char-subscripts -Wno-unused \
|
||||
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS \
|
||||
-DKSFORBUILD -I$(INC:/=) -I../jfaud/src
|
||||
-DKSFORBUILD -I$(INC:/=)
|
||||
OURCXXFLAGS=-fno-exceptions -fno-rtti
|
||||
GAMECFLAGS=-I../jfaud/inc -I$(GAME)
|
||||
LIBS=
|
||||
GAMELIBS=../jfaud/libjfaud.a #../jfaud/mpadec/libmpadec/libmpadec.a
|
||||
ASFLAGS=-s #-g
|
||||
|
@ -179,7 +181,7 @@ endif
|
|||
|
||||
UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2art$(EXESUFFIX) wad2map$(EXESUFFIX)
|
||||
|
||||
all: game$(EXESUFFIX) build$(EXESUFFIX) $(OBJ)$(ENGINELIB) $(OBJ)$(EDITORLIB)
|
||||
all: testgame$(EXESUFFIX) build$(EXESUFFIX) $(OBJ)$(ENGINELIB) $(OBJ)$(EDITORLIB)
|
||||
utils: $(UTILS)
|
||||
|
||||
enginelib: $(OBJ)$(ENGINELIB)
|
||||
|
@ -192,7 +194,7 @@ $(OBJ)$(EDITORLIB): $(EDITOROBJS)
|
|||
$(AR) rc $@ $^
|
||||
$(RANLIB) $@
|
||||
|
||||
game$(EXESUFFIX): $(GAMEEXEOBJS)
|
||||
testgame$(EXESUFFIX): $(GAMEEXEOBJS)
|
||||
$(CC) $(CFLAGS) $(OURCFLAGS) -o $@ $^ $(GAMELIBS) $(LIBS) $(STDCPPLIB)
|
||||
|
||||
build$(EXESUFFIX): $(EDITOREXEOBJS)
|
||||
|
@ -231,11 +233,8 @@ $(OBJ)%.$o: $(SRC)%.c
|
|||
$(OBJ)%.$o: $(SRC)%.cpp
|
||||
$(CXX) $(CXXFLAGS) $(OURCXXFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
|
||||
|
||||
$(OBJ)%.$o: $(SRC)tmp/%.c
|
||||
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
|
||||
|
||||
$(OBJ)%.$o: $(SRC)misc/%.rc
|
||||
$(RC) -i $< -o $@ --include-dir=$(INC) --include-dir=$(SRC)
|
||||
$(RC) -i $< -o $@ --include-dir=$(INC) --include-dir=$(SRC) --include-dir=$(GAME)
|
||||
|
||||
$(OBJ)%.$o: $(SRC)util/%.c
|
||||
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
|
||||
|
@ -243,6 +242,12 @@ $(OBJ)%.$o: $(SRC)util/%.c
|
|||
$(OBJ)%.$o: $(RSRC)%.c
|
||||
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
|
||||
|
||||
$(OBJ)%.$o: $(GAME)%.c
|
||||
$(CC) $(CFLAGS) $(OURCFLAGS) $(GAMECFLAGS) -c $< -o $@ 2>&1
|
||||
|
||||
$(OBJ)%.$o: $(GAME)%.cpp
|
||||
$(CXX) $(CXXFLAGS) $(OURCXXFLAGS) $(OURCFLAGS) $(GAMECFLAGS) -c $< -o $@ 2>&1
|
||||
|
||||
$(OBJ)game_banner.$o: $(RSRC)game_banner.c
|
||||
$(OBJ)editor_banner.$o: $(RSRC)editor_banner.c
|
||||
$(RSRC)game_banner.c: $(RSRC)game.bmp
|
||||
|
@ -264,7 +269,7 @@ endif
|
|||
veryclean: clean
|
||||
ifeq ($(PLATFORM),DARWIN)
|
||||
else
|
||||
-rm -f $(ENGINELIB) $(EDITORLIB) game$(EXESUFFIX) build$(EXESUFFIX) $(UTILS)
|
||||
-rm -f $(ENGINELIB) $(EDITORLIB) testgame$(EXESUFFIX) build$(EXESUFFIX) $(UTILS)
|
||||
endif
|
||||
|
||||
.PHONY: fixlineends
|
||||
|
|
|
@ -3,17 +3,14 @@
|
|||
$(OBJ)a-c.$o: $(SRC)a-c.c $(INC)a.h
|
||||
$(OBJ)a.$o: $(SRC)a.$(asm)
|
||||
$(OBJ)baselayer.$o: $(SRC)baselayer.c $(INC)compat.h $(INC)baselayer.h $(INC)build.h $(INC)osd.h
|
||||
$(OBJ)bstub.$o: $(SRC)bstub.c $(INC)compat.h $(INC)a.h $(INC)build.h $(INC)pragmas.h $(INC)baselayer.h $(INC)names.h $(INC)osd.h $(INC)cache1d.h $(INC)editor.h
|
||||
$(OBJ)build.$o: $(SRC)build.c $(INC)build.h $(INC)pragmas.h $(INC)compat.h $(INC)baselayer.h $(INC)editor.h
|
||||
$(OBJ)cache1d.$o: $(SRC)cache1d.c $(INC)compat.h $(INC)cache1d.h $(INC)pragmas.h $(INC)baselayer.h
|
||||
$(OBJ)compat.$o: $(SRC)compat.c $(INC)compat.h
|
||||
$(OBJ)config.$o: $(SRC)config.c $(INC)compat.h $(INC)osd.h $(INC)editor.h
|
||||
$(OBJ)crc32.$o: $(SRC)crc32.c $(INC)crc32.h
|
||||
$(OBJ)defs.$o: $(SRC)defs.c $(INC)build.h $(INC)baselayer.h $(INC)scriptfile.h $(INC)compat.h
|
||||
$(OBJ)engine.$o: $(SRC)engine.c $(SRC)polymost.c $(SRC)polymer.c $(INC)kplib.h $(SRC)hightile.c $(SRC)mdsprite.c $(INC)md4.h $(INC)lzf.h $(INC)lzwnew.h $(INC)compat.h $(INC)build.h $(INC)pragmas.h $(INC)cache1d.h $(INC)a.h $(INC)osd.h $(INC)baselayer.h
|
||||
$(OBJ)game.$o: $(SRC)game.c $(INC)compat.h $(INC)build.h $(INC)names.h $(INC)pragmas.h $(INC)cache1d.h $(INC)game.h $(INC)osd.h $(INC)baselayer.h
|
||||
$(OBJ)engine.$o: $(SRC)engine.c $(SRC)polymost.c $(INC)kplib.h $(SRC)hightile.c $(SRC)mdsprite.c $(INC)md4.h $(INC)lzf.h $(INC)lzwnew.h $(INC)compat.h $(INC)build.h $(INC)pragmas.h $(INC)cache1d.h $(INC)a.h $(INC)osd.h $(INC)baselayer.h
|
||||
$(OBJ)glbuild.$o: $(SRC)glbuild.c $(INC)glbuild.h $(INC)baselayer.h
|
||||
$(OBJ)jfaud_sound.$o: $(SRC)jfaud_sound.cpp $(INC)osd.h $(INC)compat.h $(INC)cache1d.h
|
||||
$(OBJ)kplib.$o: $(SRC)kplib.c $(INC)compat.h
|
||||
$(OBJ)lzf_c.$o: $(SRC)lzf_c.c $(SRC)lzfP.h
|
||||
$(OBJ)lzf_d.$o: $(SRC)lzf_d.c $(SRC)lzfP.h
|
||||
|
@ -30,12 +27,17 @@ $(OBJ)winlayer.$o: $(SRC)winlayer.c $(INC)compat.h $(INC)winlayer.h $(INC)basela
|
|||
$(OBJ)gtkbits.$o: $(SRC)gtkbits.c $(INC)baselayer.h $(INC)build.h $(INC)dynamicgtk.h
|
||||
$(OBJ)dynamicgtk.$o: $(SRC)dynamicgtk.c $(INC)dynamicgtk.h
|
||||
|
||||
$(OBJ)gameres.$(res): $(SRC)misc/gameres.rc $(SRC)startwin.game.h
|
||||
# KenBuild test game
|
||||
$(OBJ)game.$o: $(GAME)game.c $(INC)compat.h $(INC)build.h $(GAME)names.h $(INC)pragmas.h $(INC)cache1d.h $(GAME)game.h $(INC)osd.h $(INC)baselayer.h
|
||||
$(OBJ)bstub.$o: $(GAME)bstub.c $(INC)compat.h $(INC)a.h $(INC)build.h $(INC)pragmas.h $(INC)baselayer.h $(GAME)names.h $(INC)osd.h $(INC)cache1d.h $(INC)editor.h
|
||||
$(OBJ)jfaud_sound.$o: $(GAME)jfaud_sound.cpp $(INC)osd.h $(INC)compat.h $(INC)cache1d.h
|
||||
$(OBJ)startwin.game.$o: $(GAME)startwin.game.c $(INC)build.h $(INC)editor.h $(INC)winlayer.h $(INC)compat.h $(GAME)startwin.game.h
|
||||
$(OBJ)startgtk.game.$o: $(GAME)startgtk.game.c $(INC)baselayer.h $(INC)build.h $(INC)compat.h
|
||||
|
||||
$(OBJ)gameres.$(res): $(SRC)misc/gameres.rc $(GAME)startwin.game.h
|
||||
$(OBJ)buildres.$(res): $(SRC)misc/buildres.rc $(INC)startwin.editor.h
|
||||
$(OBJ)startwin.editor.$o: $(SRC)startwin.editor.c $(INC)build.h $(INC)editor.h $(INC)winlayer.h $(INC)compat.h $(INC)startwin.editor.h
|
||||
$(OBJ)startwin.game.$o: $(SRC)startwin.game.c $(INC)build.h $(INC)editor.h $(INC)winlayer.h $(INC)compat.h $(SRC)startwin.game.h
|
||||
$(OBJ)startgtk.editor.$o: $(SRC)startgtk.editor.c $(INC)baselayer.h $(INC)build.h $(INC)editor.h $(INC)compat.h
|
||||
$(OBJ)startgtk.game.$o: $(SRC)startgtk.game.c $(INC)baselayer.h $(INC)build.h $(INC)compat.h
|
||||
|
||||
$(OBJ)game_icon.$o: $(RSRC)game_icon.c
|
||||
$(OBJ)build_icon.$o: $(RSRC)build_icon.c
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
!endif
|
||||
|
||||
SRC=src\ #
|
||||
GAME=game\ #
|
||||
!ifndef OBJ
|
||||
OBJ=obj.msc\ #
|
||||
!endif
|
||||
|
@ -47,6 +48,7 @@ AS=ml
|
|||
RC=rc
|
||||
LINK=link /opt:nowin98 /opt:ref /nologo
|
||||
CFLAGS=$(CFLAGS) /nologo /MD /J $(flags_cl) $(TARGETOPTS) /I$(INC) /I$(DXROOT)\include /I$(FMODROOT)\inc
|
||||
GAMECFLAGS=/I$(GAME)
|
||||
LIBS=fmodvc.lib #opengl32.lib
|
||||
ASFLAGS=/nologo /coff
|
||||
EXESUFFIX=.exe
|
||||
|
@ -87,7 +89,7 @@ EDITOREXEOBJS=$(OBJ)bstub.$o \
|
|||
$(OBJ)$(ENGINELIB)
|
||||
|
||||
RENDERTYPE=WIN
|
||||
LIBS=$(LIBS) user32.lib gdi32.lib shell32.lib dxguid.lib wsock32.lib
|
||||
LIBS=$(LIBS) user32.lib gdi32.lib shell32.lib dxguid.lib wsock32.lib comctl32.lib
|
||||
CFLAGS=$(CFLAGS) /DRENDERTYPE$(RENDERTYPE)=1
|
||||
|
||||
# RULES
|
||||
|
@ -103,11 +105,20 @@ CFLAGS=$(CFLAGS) /DRENDERTYPE$(RENDERTYPE)=1
|
|||
$(CC) /c $(CFLAGS) /Fo$@ $<
|
||||
|
||||
{$(SRC)misc}.rc{$(OBJ)}.$(res):
|
||||
$(RC) /fo$@ /r $<
|
||||
$(RC) /i$(INC) /i$(GAME) /fo$@ /r $<
|
||||
|
||||
{$(SRC)}.c{$(OBJ)}.$o:
|
||||
$(CC) /c $(CFLAGS) /Fo$@ $<
|
||||
|
||||
{$(SRC)}.cpp{$(OBJ)}.$o:
|
||||
$(CC) /c $(CFLAGS) /Fo$@ $<
|
||||
|
||||
{$(GAME)}.c{$(OBJ)}.$o:
|
||||
$(CC) /c $(CFLAGS) $(GAMECFLAGS) /Fo$@ $<
|
||||
|
||||
{$(GAME)}.cpp{$(OBJ)}.$o:
|
||||
$(CC) /c $(CFLAGS) $(GAMECFLAGS) /Fo$@ $<
|
||||
|
||||
# TARGETS
|
||||
UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2map$(EXESUFFIX) wad2map$(EXESUFFIX)
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
!endif
|
||||
|
||||
SRC=src\
|
||||
GAME=game\
|
||||
!ifndef OBJ
|
||||
OBJ=obj.watcom\
|
||||
!endif
|
||||
|
@ -21,7 +22,6 @@ ENGINELIB=engine.lib
|
|||
EDITORLIB=build.lib
|
||||
|
||||
DXROOT=c:\sdks\directx\dx7
|
||||
FMODROOT=c:\sdks\fmodapi374win\api
|
||||
|
||||
!ifdef __LOADDLL__
|
||||
! loaddll wcc386 wccd386
|
||||
|
@ -37,11 +37,13 @@ FMODROOT=c:\sdks\fmodapi374win\api
|
|||
TARGETOPTS=#-dUSE_A_C #-dNOASM
|
||||
|
||||
CC=wcc386
|
||||
CXX=wpp386
|
||||
AS=wasm
|
||||
RC=wrc
|
||||
CFLAGS+= -5r -s -orb -fp5 $(TARGETOPTS) -d2 -dRENDERTYPEWIN=1 &
|
||||
-i=$(INC) -i=$(DXROOT)\include -i=$(FMODROOT)\inc
|
||||
LIBS=dxguid.lib wsock32.lib fmodwc.lib #opengl32.lib
|
||||
CFLAGS+= -zq -5r -s -orb -fp5 $(TARGETOPTS) -d2 -dRENDERTYPEWIN=1 &
|
||||
-i=watcomhax -i=$(INC) -i=$(SRC) -i=$(DXROOT)\include -i=..\jfaud\inc
|
||||
GAMECFLAGS=-i=$(GAME)
|
||||
LIBS=dxguid.lib wsock32.lib ..\jfaud\jfaud.lib winmm.lib #opengl32.lib
|
||||
ASFLAGS=# -d1
|
||||
EXESUFFIX=.exe
|
||||
|
||||
|
@ -69,7 +71,7 @@ EDITOROBJS=$(OBJ)build.$o &
|
|||
$(OBJ)startwin.editor.$o
|
||||
|
||||
GAMEEXEOBJS=$(OBJ)game.$o &
|
||||
$(OBJ)sound.$o &
|
||||
$(OBJ)jfaud_sound.$o &
|
||||
$(OBJ)config.$o &
|
||||
$(OBJ)startwin.game.$o
|
||||
|
||||
|
@ -80,7 +82,9 @@ EDITOREXEOBJS=$(OBJ)bstub.$o
|
|||
|
||||
.wasm: $(SRC)
|
||||
.c: $(SRC)
|
||||
.c: $(SRC)tmp/
|
||||
.cpp: $(SRC)
|
||||
.c: $(GAME)
|
||||
.cpp: $(GAME)
|
||||
.c: $(SRC)util/
|
||||
.rc: $(SRC)misc/
|
||||
|
||||
|
@ -89,9 +93,11 @@ EDITOREXEOBJS=$(OBJ)bstub.$o
|
|||
|
||||
.c.$o:
|
||||
$(CC) $(CFLAGS) -fo=$(OBJ).$o $[@
|
||||
.cpp.$o:
|
||||
$(CXX) $(CFLAGS) $(GAMECFLAGS) -fo=$(OBJ).$o $[@
|
||||
|
||||
.rc.$(res):
|
||||
$(RC) -fo=$^*.$(res) -r $[@
|
||||
$(RC) -i=$(SRC) -i=$(INC) -i=$(GAME) -fo=$^*.$(res) -r $[@
|
||||
|
||||
# TARGETS
|
||||
UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2art$(EXESUFFIX) wad2map$(EXESUFFIX)
|
||||
|
|
564
polymer/build/game/bstub.c
Executable file
564
polymer/build/game/bstub.c
Executable file
|
@ -0,0 +1,564 @@
|
|||
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
||||
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
||||
// See the included license file "BUILDLIC.TXT" for license info.
|
||||
//
|
||||
// This file has been modified from Ken Silverman's original release
|
||||
// by Jonathon Fowler (jonof@edgenetwk.com)
|
||||
|
||||
#include "compat.h"
|
||||
#include "a.h"
|
||||
#include "build.h"
|
||||
#include "editor.h"
|
||||
#include "pragmas.h"
|
||||
#include "baselayer.h"
|
||||
#include "names.h"
|
||||
#include "osd.h"
|
||||
#include "cache1d.h"
|
||||
|
||||
|
||||
static char tempbuf[256];
|
||||
|
||||
#define NUMOPTIONS 9
|
||||
char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
|
||||
char keys[NUMBUILDKEYS] =
|
||||
{
|
||||
0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39,
|
||||
0x1e,0x2c,0xd1,0xc9,0x33,0x34,
|
||||
0x9c,0x1c,0xd,0xc,0xf,0x45
|
||||
};
|
||||
|
||||
|
||||
|
||||
//static long hang = 0;
|
||||
//static long rollangle = 0;
|
||||
|
||||
//Detecting 2D / 3D mode:
|
||||
// qsetmode is 200 in 3D mode
|
||||
// qsetmode is 350/480 in 2D mode
|
||||
//
|
||||
//You can read these variables when F5-F8 is pressed in 3D mode only:
|
||||
//
|
||||
// If (searchstat == 0) WALL searchsector=sector, searchwall=wall
|
||||
// If (searchstat == 1) CEILING searchsector=sector
|
||||
// If (searchstat == 2) FLOOR searchsector=sector
|
||||
// If (searchstat == 3) SPRITE searchsector=sector, searchwall=sprite
|
||||
// If (searchstat == 4) MASKED WALL searchsector=sector, searchwall=wall
|
||||
//
|
||||
// searchsector is the sector of the selected item for all 5 searchstat's
|
||||
//
|
||||
// searchwall is undefined if searchstat is 1 or 2
|
||||
// searchwall is the wall if searchstat = 0 or 4
|
||||
// searchwall is the sprite if searchstat = 3 (Yeah, I know - it says wall,
|
||||
// but trust me, it's the sprite number)
|
||||
|
||||
long averagefps;
|
||||
#define AVERAGEFRAMES 32
|
||||
static unsigned long frameval[AVERAGEFRAMES];
|
||||
static long framecnt = 0;
|
||||
|
||||
char *defsfilename = "kenbuild.def";
|
||||
char *startwin_labeltext = "Starting Build Editor...";
|
||||
int nextvoxid = 0;
|
||||
|
||||
int ExtInit(void)
|
||||
{
|
||||
long i, rv = 0;
|
||||
|
||||
/*printf("------------------------------------------------------------------------------\n");
|
||||
printf(" BUILD.EXE copyright(c) 1996 by Ken Silverman. You are granted the\n");
|
||||
printf(" right to use this software for your personal use only. This is a\n");
|
||||
printf(" special version to be used with \"Happy Fun KenBuild\" and may not work\n");
|
||||
printf(" properly with other Build engine games. Please refer to license.doc\n");
|
||||
printf(" for distribution rights\n");
|
||||
printf("------------------------------------------------------------------------------\n");
|
||||
getch();
|
||||
*/
|
||||
|
||||
initgroupfile("stuff.dat");
|
||||
bpp = 8;
|
||||
if (loadsetup("build.cfg") < 0) initprintf("Configuration file not found, using defaults.\n"), rv = 1;
|
||||
Bmemcpy((void *)buildkeys,(void *)keys,NUMBUILDKEYS); //Trick to make build use setup.dat keys
|
||||
if (option[4] > 0) option[4] = 0;
|
||||
if (initengine()) {
|
||||
wm_msgbox("Build Engine Initialisation Error",
|
||||
"There was a problem initialising the Build engine: %s", engineerrstr);
|
||||
return -1;
|
||||
}
|
||||
initinput();
|
||||
initmouse();
|
||||
|
||||
//You can load your own palette lookup tables here if you just
|
||||
//copy the right code!
|
||||
for(i=0;i<256;i++)
|
||||
tempbuf[i] = ((i+32)&255); //remap colors for screwy palette sectors
|
||||
makepalookup(16,tempbuf,0,0,0,1);
|
||||
|
||||
kensplayerheight = 32;
|
||||
zmode = 0;
|
||||
defaultspritecstat = 0;
|
||||
pskyoff[0] = 0; pskyoff[1] = 0; pskybits = 1;
|
||||
|
||||
#ifdef SUPERBUILD
|
||||
tiletovox[PLAYER] = nextvoxid++;
|
||||
tiletovox[BROWNMONSTER] = nextvoxid++;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
// allowtaskswitching(0);
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
void ExtUnInit(void)
|
||||
{
|
||||
uninitgroupfile();
|
||||
writesetup("build.cfg");
|
||||
}
|
||||
|
||||
//static long daviewingrange, daaspect, horizval1, horizval2;
|
||||
void ExtPreCheckKeys(void)
|
||||
{
|
||||
long /*cosang, sinang, dx, dy, mindx,*/ i, j, k;
|
||||
|
||||
if (keystatus[0x3e]) //F4 - screen re-size
|
||||
{
|
||||
keystatus[0x3e] = 0;
|
||||
|
||||
//cycle through all vesa modes, then screen-buffer mode
|
||||
if (keystatus[0x2a]|keystatus[0x36]) {
|
||||
setgamemode(!fullscreen, xdim, ydim, bpp);
|
||||
} else {
|
||||
|
||||
//cycle through all modes
|
||||
j=-1;
|
||||
|
||||
// work out a mask to select the mode
|
||||
for (i=0; i<validmodecnt; i++)
|
||||
if ((validmode[i].xdim == xdim) &&
|
||||
(validmode[i].ydim == ydim) &&
|
||||
(validmode[i].fs == fullscreen) &&
|
||||
(validmode[i].bpp == bpp))
|
||||
{ j=i; break; }
|
||||
|
||||
for (k=0; k<validmodecnt; k++)
|
||||
if (validmode[k].fs == fullscreen && validmode[k].bpp == bpp) break;
|
||||
|
||||
if (j==-1) j=k;
|
||||
else {
|
||||
j++;
|
||||
if (j==validmodecnt) j=k;
|
||||
}
|
||||
setgamemode(fullscreen,validmode[j].xdim,validmode[j].ydim,bpp);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (keystatus[0x2a]|keystatus[0x36])
|
||||
{
|
||||
if (keystatus[0xcf]) hang = max(hang-1,-182);
|
||||
if (keystatus[0xc7]) hang = min(hang+1,182);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (keystatus[0xcf]) hang = max(hang-8,-182);
|
||||
if (keystatus[0xc7]) hang = min(hang+8,182);
|
||||
}
|
||||
if (keystatus[0x4c]) { hang = 0; horiz = 100; }
|
||||
if (hang != 0)
|
||||
{
|
||||
walock[4094] = 255;
|
||||
|
||||
// JBF 20031117: scale each dimension by a factor of 1.2, and work out
|
||||
// the aspect of the screen. Anywhere you see 'i' below was the value
|
||||
// '200' before I changed it. NOTE: This whole trick crashes in resolutions
|
||||
// above 800x600. I'm not sure why, and fixing it is not something I intend
|
||||
// to do in a real big hurry.
|
||||
dx = (xdim + (xdim >> 3) + (xdim >> 4) + (xdim >> 6)) & (~7);
|
||||
dy = (ydim + (ydim >> 3) + (ydim >> 4) + (ydim >> 6)) & (~7);
|
||||
i = scale(320,ydim,xdim);
|
||||
|
||||
if (waloff[4094] == 0) allocache(&waloff[4094],/*240L*384L*/dx*dy,&walock[4094]);
|
||||
setviewtotile(4094,/*240L,384L*/dy,dx);
|
||||
|
||||
cosang = sintable[(hang+512)&2047];
|
||||
sinang = sintable[hang&2047];
|
||||
|
||||
dx = dmulscale1(320,cosang,i,sinang); mindx = dx;
|
||||
dy = dmulscale1(-i,cosang,320,sinang);
|
||||
horizval1 = dy*(320>>1)/dx-1;
|
||||
|
||||
dx = dmulscale1(320,cosang,-i,sinang); mindx = min(dx,mindx);
|
||||
dy = dmulscale1(i,cosang,320,sinang);
|
||||
horizval2 = dy*(320>>1)/dx+1;
|
||||
|
||||
daviewingrange = scale(65536,16384*(xdim>>1),mindx-16);
|
||||
daaspect = scale(daviewingrange,scale(320,tilesizx[4094],tilesizy[4094]),horizval2+6-horizval1);
|
||||
setaspect(daviewingrange,scale(daaspect,ydim*320,xdim*i));
|
||||
horiz = 100-divscale15(horizval1+horizval2,daviewingrange);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SUPERBUILD
|
||||
#define MAXVOXMIPS 5
|
||||
extern char *voxoff[][MAXVOXMIPS];
|
||||
void ExtAnalyzeSprites(void)
|
||||
{
|
||||
long i, *longptr;
|
||||
spritetype *tspr;
|
||||
|
||||
for(i=0,tspr=&tsprite[0];i<spritesortcnt;i++,tspr++)
|
||||
{
|
||||
if (usevoxels && tiletovox[tspr->picnum] >= 0)
|
||||
{
|
||||
switch(tspr->picnum)
|
||||
{
|
||||
case PLAYER:
|
||||
if (!voxoff[ tiletovox[PLAYER] ][0]) {
|
||||
if (qloadkvx(tiletovox[PLAYER],"voxel000.kvx")) {
|
||||
tiletovox[PLAYER] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//tspr->cstat |= 48; tspr->picnum = tiletovox[tspr->picnum];
|
||||
longptr = (long *)voxoff[ tiletovox[PLAYER] ][0];
|
||||
tspr->xrepeat = scale(tspr->xrepeat,56,longptr[2]);
|
||||
tspr->yrepeat = scale(tspr->yrepeat,56,longptr[2]);
|
||||
tspr->shade -= 6;
|
||||
break;
|
||||
case BROWNMONSTER:
|
||||
if (!voxoff[ tiletovox[BROWNMONSTER] ][0]) {
|
||||
if (qloadkvx(tiletovox[BROWNMONSTER],"voxel001.kvx")) {
|
||||
tiletovox[BROWNMONSTER] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//tspr->cstat |= 48; tspr->picnum = tiletovox[tspr->picnum];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tspr->shade += 6;
|
||||
if (sector[tspr->sectnum].ceilingstat&1)
|
||||
tspr->shade += sector[tspr->sectnum].ceilingshade;
|
||||
else
|
||||
tspr->shade += sector[tspr->sectnum].floorshade;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void ExtCheckKeys(void)
|
||||
{
|
||||
long i;//, p, y, dx, dy, cosang, sinang, bufplc, tsizy, tsizyup15;
|
||||
long j;
|
||||
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
#if 0
|
||||
if (hang != 0)
|
||||
{
|
||||
bufplc = waloff[4094]+(mulscale16(horiz-100,xdimenscale)+(tilesizx[4094]>>1))*tilesizy[4094];
|
||||
setviewback();
|
||||
cosang = sintable[(hang+512)&2047];
|
||||
sinang = sintable[hang&2047];
|
||||
dx = dmulscale1(xdim,cosang,ydim,sinang);
|
||||
dy = dmulscale1(-ydim,cosang,xdim,sinang);
|
||||
|
||||
begindrawing();
|
||||
tsizy = tilesizy[4094];
|
||||
tsizyup15 = (tsizy<<15);
|
||||
dx = mulscale14(dx,daviewingrange);
|
||||
dy = mulscale14(dy,daaspect);
|
||||
sinang = mulscale14(sinang,daviewingrange);
|
||||
cosang = mulscale14(cosang,daaspect);
|
||||
p = ylookup[windowy1]+frameplace+windowx2+1;
|
||||
for(y=windowy1;y<=windowy2;y++)
|
||||
{
|
||||
i = divscale16(tsizyup15,dx);
|
||||
stretchhline(0,(xdim>>1)*i+tsizyup15,xdim>>2,i,mulscale32(i,dy)*tsizy+bufplc,p);
|
||||
dx -= sinang; dy += cosang; p += ylookup[1];
|
||||
}
|
||||
walock[4094] = 1;
|
||||
|
||||
Bsprintf(tempbuf,"%d",(hang*180)>>10);
|
||||
printext256(0L,8L,31,-1,tempbuf,1);
|
||||
enddrawing();
|
||||
}
|
||||
#endif
|
||||
if (keystatus[0xa]) setaspect(viewingrange+(viewingrange>>8),yxaspect+(yxaspect>>8));
|
||||
if (keystatus[0xb]) setaspect(viewingrange-(viewingrange>>8),yxaspect-(yxaspect>>8));
|
||||
if (keystatus[0xc]) setaspect(viewingrange,yxaspect-(yxaspect>>8));
|
||||
if (keystatus[0xd]) setaspect(viewingrange,yxaspect+(yxaspect>>8));
|
||||
//if (keystatus[0x38]) setrollangle(rollangle+=((keystatus[0x2a]|keystatus[0x36])*6+2));
|
||||
//if (keystatus[0xb8]) setrollangle(rollangle-=((keystatus[0x2a]|keystatus[0x36])*6+2));
|
||||
//if (keystatus[0x1d]|keystatus[0x9d]) setrollangle(rollangle=0);
|
||||
|
||||
begindrawing();
|
||||
|
||||
i = frameval[framecnt&(AVERAGEFRAMES-1)];
|
||||
j = frameval[framecnt&(AVERAGEFRAMES-1)] = getticks(); framecnt++;
|
||||
if (i != j) averagefps = ((mul3(averagefps)+((AVERAGEFRAMES*1000)/(j-i)) )>>2);
|
||||
Bsprintf(tempbuf,"%ld",averagefps);
|
||||
printext256(0L,0L,31,-1,tempbuf,1);
|
||||
|
||||
enddrawing();
|
||||
editinput();
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void ExtCleanUp(void)
|
||||
{
|
||||
}
|
||||
|
||||
void ExtPreLoadMap(void)
|
||||
{
|
||||
}
|
||||
|
||||
void ExtLoadMap(const char *mapname)
|
||||
{
|
||||
char title[256];
|
||||
Bsprintf(title, "BUILD by Ken Silverman - %s", mapname);
|
||||
wm_setapptitle(title);
|
||||
}
|
||||
|
||||
void ExtPreSaveMap(void)
|
||||
{
|
||||
}
|
||||
|
||||
void ExtSaveMap(const char *mapname)
|
||||
{
|
||||
}
|
||||
|
||||
const char *ExtGetSectorCaption(short sectnum)
|
||||
{
|
||||
if ((sector[sectnum].lotag|sector[sectnum].hitag) == 0)
|
||||
{
|
||||
tempbuf[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Bsprintf(tempbuf,"%hu,%hu",(unsigned short)sector[sectnum].hitag,
|
||||
(unsigned short)sector[sectnum].lotag);
|
||||
}
|
||||
return(tempbuf);
|
||||
}
|
||||
|
||||
const char *ExtGetWallCaption(short wallnum)
|
||||
{
|
||||
if ((wall[wallnum].lotag|wall[wallnum].hitag) == 0)
|
||||
{
|
||||
tempbuf[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Bsprintf(tempbuf,"%hu,%hu",(unsigned short)wall[wallnum].hitag,
|
||||
(unsigned short)wall[wallnum].lotag);
|
||||
}
|
||||
return(tempbuf);
|
||||
}
|
||||
|
||||
const char *ExtGetSpriteCaption(short spritenum)
|
||||
{
|
||||
if ((sprite[spritenum].lotag|sprite[spritenum].hitag) == 0)
|
||||
{
|
||||
tempbuf[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Bsprintf(tempbuf,"%hu,%hu",(unsigned short)sprite[spritenum].hitag,
|
||||
(unsigned short)sprite[spritenum].lotag);
|
||||
}
|
||||
return(tempbuf);
|
||||
}
|
||||
|
||||
//printext16 parameters:
|
||||
//printext16(long xpos, long ypos, short col, short backcol,
|
||||
// char name[82], char fontsize)
|
||||
// xpos 0-639 (top left)
|
||||
// ypos 0-479 (top left)
|
||||
// col 0-15
|
||||
// backcol 0-15, -1 is transparent background
|
||||
// name
|
||||
// fontsize 0=8*8, 1=3*5
|
||||
|
||||
//drawline16 parameters:
|
||||
// drawline16(long x1, long y1, long x2, long y2, char col)
|
||||
// x1, x2 0-639
|
||||
// y1, y2 0-143 (status bar is 144 high, origin is top-left of STATUS BAR)
|
||||
// col 0-15
|
||||
|
||||
void ExtShowSectorData(short sectnum) //F5
|
||||
{
|
||||
int i;
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
begindrawing();
|
||||
clearmidstatbar16(); //Clear middle of status bar
|
||||
|
||||
Bsprintf(tempbuf,"Sector %d",sectnum);
|
||||
printext16(8,ydim16+32,11,-1,tempbuf,0);
|
||||
|
||||
printext16(8,ydim16+48,11,-1,"8*8 font: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789",0);
|
||||
printext16(8,ydim16+56,11,-1,"3*5 font: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789",1);
|
||||
|
||||
i=ydim16; ydim16=ydim;
|
||||
drawline16(320,i+68,344,i+80,4); //Draw house
|
||||
drawline16(344,i+80,344,i+116,4);
|
||||
drawline16(344,i+116,296,i+116,4);
|
||||
drawline16(296,i+116,296,i+80,4);
|
||||
drawline16(296,i+80,320,i+68,4);
|
||||
ydim16=i;
|
||||
enddrawing();
|
||||
}
|
||||
}
|
||||
|
||||
void ExtShowWallData(short wallnum) //F6
|
||||
{
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
begindrawing();
|
||||
clearmidstatbar16(); //Clear middle of status bar
|
||||
|
||||
Bsprintf(tempbuf,"Wall %d",wallnum);
|
||||
printext16(8,ydim16+32,11,-1,tempbuf,0);
|
||||
enddrawing();
|
||||
}
|
||||
}
|
||||
|
||||
void ExtShowSpriteData(short spritenum) //F6
|
||||
{
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
begindrawing();
|
||||
clearmidstatbar16(); //Clear middle of status bar
|
||||
|
||||
Bsprintf(tempbuf,"Sprite %d",spritenum);
|
||||
printext16(8,ydim16+32,11,-1,tempbuf,0);
|
||||
enddrawing();
|
||||
}
|
||||
}
|
||||
|
||||
void ExtEditSectorData(short sectnum) //F7
|
||||
{
|
||||
short nickdata;
|
||||
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
//Ceiling
|
||||
if (searchstat == 1)
|
||||
sector[searchsector].ceilingpicnum++; //Just a stupid example
|
||||
|
||||
//Floor
|
||||
if (searchstat == 2)
|
||||
sector[searchsector].floorshade++; //Just a stupid example
|
||||
}
|
||||
else //In 2D mode
|
||||
{
|
||||
Bsprintf(tempbuf,"Sector (%d) Nick's variable: ",sectnum);
|
||||
nickdata = 0;
|
||||
nickdata = getnumber16(tempbuf,nickdata,65536L,0);
|
||||
|
||||
printmessage16(""); //Clear message box (top right of status bar)
|
||||
ExtShowSectorData(sectnum);
|
||||
}
|
||||
}
|
||||
|
||||
void ExtEditWallData(short wallnum) //F8
|
||||
{
|
||||
short nickdata;
|
||||
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
Bsprintf(tempbuf,"Wall (%d) Nick's variable: ",wallnum);
|
||||
nickdata = 0;
|
||||
nickdata = getnumber16(tempbuf,nickdata,65536L,0);
|
||||
|
||||
printmessage16(""); //Clear message box (top right of status bar)
|
||||
ExtShowWallData(wallnum);
|
||||
}
|
||||
}
|
||||
|
||||
void ExtEditSpriteData(short spritenum) //F8
|
||||
{
|
||||
short nickdata;
|
||||
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
Bsprintf(tempbuf,"Sprite (%d) Nick's variable: ",spritenum);
|
||||
nickdata = 0;
|
||||
nickdata = getnumber16(tempbuf,nickdata,65536L,0);
|
||||
printmessage16("");
|
||||
|
||||
printmessage16(""); //Clear message box (top right of status bar)
|
||||
ExtShowSpriteData(spritenum);
|
||||
}
|
||||
}
|
||||
|
||||
void faketimerhandler(void)
|
||||
{
|
||||
sampletimer();
|
||||
}
|
||||
|
||||
//Just thought you might want my getnumber16 code
|
||||
/*
|
||||
getnumber16(char namestart[80], short num, long maxnumber)
|
||||
{
|
||||
char buffer[80];
|
||||
long j, k, n, danum, oldnum;
|
||||
|
||||
danum = (long)num;
|
||||
oldnum = danum;
|
||||
while ((keystatus[0x1c] != 2) && (keystatus[0x1] == 0)) //Enter, ESC
|
||||
{
|
||||
sprintf(&buffer,"%s%ld_ ",namestart,danum);
|
||||
printmessage16(buffer);
|
||||
|
||||
for(j=2;j<=11;j++) //Scan numbers 0-9
|
||||
if (keystatus[j] > 0)
|
||||
{
|
||||
keystatus[j] = 0;
|
||||
k = j-1;
|
||||
if (k == 10) k = 0;
|
||||
n = (danum*10)+k;
|
||||
if (n < maxnumber) danum = n;
|
||||
}
|
||||
if (keystatus[0xe] > 0) // backspace
|
||||
{
|
||||
danum /= 10;
|
||||
keystatus[0xe] = 0;
|
||||
}
|
||||
if (keystatus[0x1c] == 1) //L. enter
|
||||
{
|
||||
oldnum = danum;
|
||||
keystatus[0x1c] = 2;
|
||||
asksave = 1;
|
||||
}
|
||||
}
|
||||
keystatus[0x1c] = 0;
|
||||
keystatus[0x1] = 0;
|
||||
return((short)oldnum);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* vim:ts=4:
|
||||
*/
|
||||
|
6290
polymer/build/game/game.c
Executable file
6290
polymer/build/game/game.c
Executable file
File diff suppressed because it is too large
Load diff
0
polymer/build/include/game.h → polymer/build/game/game.h
Normal file → Executable file
0
polymer/build/include/game.h → polymer/build/game/game.h
Normal file → Executable file
9
polymer/build/src/jfaud_sound.cpp → polymer/build/game/jfaud_sound.cpp
Normal file → Executable file
9
polymer/build/src/jfaud_sound.cpp → polymer/build/game/jfaud_sound.cpp
Normal file → Executable file
|
@ -262,9 +262,8 @@ void setears(long daposx, long daposy, long daxvect, long dayvect)
|
|||
mixer = jfaud->GetWave();
|
||||
if (!mixer) return;
|
||||
|
||||
mixer->SetListenerPosition((float)daposx/UNITSPERMTR, 0.0, (float)-daposy/UNITSPERMTR);
|
||||
mixer->SetListenerOrientation((float)daxvect/UNITSPERMTR, 0.0, (float)-dayvect/UNITSPERMTR,
|
||||
0.0, 1.0, 0.0);
|
||||
mixer->SetListenerPosition((float)daposx/UNITSPERMTR, 0.0, (float)daposy/UNITSPERMTR);
|
||||
mixer->SetListenerOrientation((float)daxvect/UNITSPERMTR, 0.0, (float)dayvect/UNITSPERMTR, 0.0, 1.0, 0.0);
|
||||
}
|
||||
|
||||
static int storehandle(JFAudMixerChannel *handle, long *daxplc, long *dayplc)
|
||||
|
@ -311,7 +310,7 @@ void wsayfollow(char *dafilename, long dafreq, long davol, long *daxplc, long *d
|
|||
|
||||
handl->SetPitch((float)dafreq / 4096.0);
|
||||
handl->SetGain((float)davol / 256.0);
|
||||
handl->SetPosition((float)(*daxplc) / UNITSPERMTR, 0.0, (float)(-*dayplc) / UNITSPERMTR);
|
||||
handl->SetPosition((float)(*daxplc) / UNITSPERMTR, 0.0, (float)(*dayplc) / UNITSPERMTR);
|
||||
handl->SetFollowListener(false);
|
||||
handl->SetRolloff(1.0);
|
||||
|
||||
|
@ -373,7 +372,7 @@ void refreshaudio(void)
|
|||
sfxchans[i].handle->SetPosition(
|
||||
(float)(*sfxchans[i].posx)/UNITSPERMTR,
|
||||
0.0,
|
||||
(float)(-*sfxchans[i].posy)/UNITSPERMTR);
|
||||
(float)(*sfxchans[i].posy)/UNITSPERMTR);
|
||||
}
|
||||
jfaud->Update();
|
||||
}
|
0
polymer/build/include/names.h → polymer/build/game/names.h
Normal file → Executable file
0
polymer/build/include/names.h → polymer/build/game/names.h
Normal file → Executable file
545
polymer/build/game/startgtk.game.c
Executable file
545
polymer/build/game/startgtk.game.c
Executable file
|
@ -0,0 +1,545 @@
|
|||
/* NOTE: Glade will generate code for a dialogue box which you should
|
||||
* then patch into this file whenever you make a change to the Glade
|
||||
* template.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixdata.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#ifndef LINKED_GTK
|
||||
# include "dynamicgtk.h"
|
||||
#endif
|
||||
|
||||
#include "baselayer.h"
|
||||
#include "compat.h"
|
||||
#include "build.h"
|
||||
|
||||
#define TAB_CONFIG 0
|
||||
#define TAB_MESSAGES 1
|
||||
|
||||
static struct {
|
||||
int fullscreen;
|
||||
int xdim3d, ydim3d, bpp3d;
|
||||
int forcesetup;
|
||||
} settings;
|
||||
|
||||
extern int gtkenabled;
|
||||
|
||||
static GtkWidget *startwin = NULL;
|
||||
static int retval = -1, mode = TAB_MESSAGES;
|
||||
|
||||
// -- SUPPORT FUNCTIONS -------------------------------------------------------
|
||||
|
||||
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
|
||||
g_object_set_data_full (G_OBJECT (component), name, \
|
||||
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
|
||||
|
||||
#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
|
||||
g_object_set_data (G_OBJECT (component), name, widget)
|
||||
|
||||
#define lookup_widget(x,w) \
|
||||
(GtkWidget*) g_object_get_data(G_OBJECT(x), w)
|
||||
|
||||
static GdkPixbuf *load_banner(void)
|
||||
{
|
||||
extern const GdkPixdata startbanner_pixdata;
|
||||
return gdk_pixbuf_from_pixdata(&startbanner_pixdata, FALSE, NULL);
|
||||
}
|
||||
|
||||
static void SetPage(int n)
|
||||
{
|
||||
if (!gtkenabled || !startwin) return;
|
||||
mode = n;
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(startwin,"tabs")), n);
|
||||
|
||||
// each control in the config page vertical layout plus the start button should be made (in)sensitive
|
||||
if (n == TAB_CONFIG) n = TRUE; else n = FALSE;
|
||||
gtk_widget_set_sensitive(lookup_widget(startwin,"startbutton"), n);
|
||||
gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"configvlayout")),
|
||||
(GtkCallback)gtk_widget_set_sensitive, (gpointer)n);
|
||||
}
|
||||
|
||||
static void on_vmode3dcombo_changed(GtkComboBox *, gpointer);
|
||||
static void PopulateForm(void)
|
||||
{
|
||||
int mode3d, i;
|
||||
GtkListStore *modes3d;
|
||||
GtkTreeIter iter;
|
||||
GtkComboBox *box3d;
|
||||
char buf[64];
|
||||
|
||||
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1);
|
||||
if (mode3d < 0) {
|
||||
int i, cd[] = { 32, 24, 16, 15, 8, 0 };
|
||||
for (i=0; cd[i]; ) { if (cd[i] >= settings.bpp3d) i++; else break; }
|
||||
for ( ; cd[i]; i++) {
|
||||
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1);
|
||||
if (mode3d < 0) continue;
|
||||
settings.bpp3d = cd[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"fullscreencheck")), settings.fullscreen);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"alwaysshowcheck")), settings.forcesetup);
|
||||
|
||||
box3d = GTK_COMBO_BOX(lookup_widget(startwin,"vmode3dcombo"));
|
||||
modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(box3d));
|
||||
gtk_list_store_clear(modes3d);
|
||||
|
||||
for (i=0; i<validmodecnt; i++) {
|
||||
if (validmode[i].fs != settings.fullscreen) continue;
|
||||
|
||||
// all modes get added to the 3D mode list
|
||||
Bsprintf(buf, "%ld x %ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
|
||||
gtk_list_store_append(modes3d, &iter);
|
||||
gtk_list_store_set(modes3d, &iter, 0,buf, 1,i, -1);
|
||||
if (i == mode3d) {
|
||||
g_signal_handlers_block_by_func(box3d, on_vmode3dcombo_changed, NULL);
|
||||
gtk_combo_box_set_active_iter(box3d, &iter);
|
||||
g_signal_handlers_unblock_by_func(box3d, on_vmode3dcombo_changed, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -- EVENT CALLBACKS AND CREATION STUFF --------------------------------------
|
||||
|
||||
static void on_vmode3dcombo_changed(GtkComboBox *combobox, gpointer user_data)
|
||||
{
|
||||
GtkTreeModel *data;
|
||||
GtkTreeIter iter;
|
||||
int val;
|
||||
if (!gtk_combo_box_get_active_iter(combobox, &iter)) return;
|
||||
if (!(data = gtk_combo_box_get_model(combobox))) return;
|
||||
gtk_tree_model_get(data, &iter, 1, &val, -1);
|
||||
settings.xdim3d = validmode[val].xdim;
|
||||
settings.ydim3d = validmode[val].ydim;
|
||||
}
|
||||
|
||||
static void on_fullscreencheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
||||
{
|
||||
settings.fullscreen = (gtk_toggle_button_get_active(togglebutton) == TRUE);
|
||||
PopulateForm();
|
||||
}
|
||||
|
||||
static void on_alwaysshowcheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
||||
{
|
||||
settings.forcesetup = (gtk_toggle_button_get_active(togglebutton) == TRUE);
|
||||
}
|
||||
|
||||
static void on_cancelbutton_clicked(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
|
||||
else quitevent++;
|
||||
}
|
||||
|
||||
static void on_startbutton_clicked(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
retval = 1;
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
static gboolean on_startwin_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data)
|
||||
{
|
||||
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
|
||||
else quitevent++;
|
||||
return TRUE; // FALSE would let the event go through. we want the game to decide when to close
|
||||
}
|
||||
|
||||
|
||||
static GtkWidget *create_window(void)
|
||||
{
|
||||
GtkWidget *startwin;
|
||||
GtkWidget *hlayout;
|
||||
GtkWidget *banner;
|
||||
GtkWidget *vlayout;
|
||||
GtkWidget *tabs;
|
||||
GtkWidget *configvlayout;
|
||||
GtkWidget *configlayout;
|
||||
GtkWidget *vmode3dlabel;
|
||||
GtkWidget *vmode3dcombo;
|
||||
GtkWidget *fullscreencheck;
|
||||
GtkWidget *alwaysshowcheck;
|
||||
GtkWidget *configtab;
|
||||
GtkWidget *messagesscroll;
|
||||
GtkWidget *messagestext;
|
||||
GtkWidget *messagestab;
|
||||
GtkWidget *buttons;
|
||||
GtkWidget *cancelbutton;
|
||||
GtkWidget *cancelbuttonalign;
|
||||
GtkWidget *cancelbuttonlayout;
|
||||
GtkWidget *cancelbuttonicon;
|
||||
GtkWidget *cancelbuttonlabel;
|
||||
GtkWidget *startbutton;
|
||||
GtkWidget *startbuttonalign;
|
||||
GtkWidget *startbuttonlayout;
|
||||
GtkWidget *startbuttonicon;
|
||||
GtkWidget *startbuttonlabel;
|
||||
GtkAccelGroup *accel_group;
|
||||
|
||||
accel_group = gtk_accel_group_new ();
|
||||
|
||||
// Basic window
|
||||
startwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (startwin), apptitle); // NOTE: use global app title
|
||||
gtk_window_set_position (GTK_WINDOW (startwin), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_resizable (GTK_WINDOW (startwin), FALSE);
|
||||
gtk_window_set_type_hint (GTK_WINDOW (startwin), GDK_WINDOW_TYPE_HINT_DIALOG);
|
||||
|
||||
// Horizontal layout of banner and controls
|
||||
hlayout = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_show (hlayout);
|
||||
gtk_container_add (GTK_CONTAINER (startwin), hlayout);
|
||||
|
||||
// Banner
|
||||
{
|
||||
GdkPixbuf *pixbuf = load_banner();
|
||||
banner = gtk_image_new_from_pixbuf(pixbuf);
|
||||
g_object_unref((gpointer)pixbuf);
|
||||
}
|
||||
gtk_widget_show (banner);
|
||||
gtk_box_pack_start (GTK_BOX (hlayout), banner, FALSE, FALSE, 0);
|
||||
gtk_misc_set_alignment (GTK_MISC (banner), 0.5, 0);
|
||||
|
||||
// Vertical layout of tab control and start+cancel buttons
|
||||
vlayout = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (vlayout);
|
||||
gtk_box_pack_start (GTK_BOX (hlayout), vlayout, TRUE, TRUE, 0);
|
||||
|
||||
// Tab control
|
||||
tabs = gtk_notebook_new ();
|
||||
gtk_widget_show (tabs);
|
||||
gtk_box_pack_start (GTK_BOX (vlayout), tabs, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (tabs), 4);
|
||||
|
||||
// Vertical layout of config page main body
|
||||
configvlayout = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (configvlayout);
|
||||
gtk_container_add (GTK_CONTAINER (tabs), configvlayout);
|
||||
|
||||
// Fixed-position layout of config page controls
|
||||
configlayout = gtk_fixed_new ();
|
||||
gtk_widget_show (configlayout);
|
||||
gtk_box_pack_start (GTK_BOX (configvlayout), configlayout, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (configlayout), 6);
|
||||
|
||||
// 3D video mode label
|
||||
vmode3dlabel = gtk_label_new_with_mnemonic ("_Video mode:");
|
||||
gtk_widget_show (vmode3dlabel);
|
||||
gtk_fixed_put (GTK_FIXED (configlayout), vmode3dlabel, 0, 0);
|
||||
gtk_widget_set_size_request (vmode3dlabel, 88, 29);
|
||||
gtk_misc_set_alignment (GTK_MISC (vmode3dlabel), 0, 0.5);
|
||||
|
||||
// 3D video mode combo
|
||||
{
|
||||
GtkListStore *list = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
|
||||
GtkCellRenderer *cell;
|
||||
|
||||
vmode3dcombo = gtk_combo_box_new_with_model (GTK_TREE_MODEL(list));
|
||||
g_object_unref(G_OBJECT(list));
|
||||
|
||||
cell = gtk_cell_renderer_text_new();
|
||||
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(vmode3dcombo), cell, FALSE);
|
||||
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(vmode3dcombo), cell, "text", 0, NULL);
|
||||
}
|
||||
gtk_widget_show (vmode3dcombo);
|
||||
gtk_fixed_put (GTK_FIXED (configlayout), vmode3dcombo, 88, 0);
|
||||
gtk_widget_set_size_request (vmode3dcombo, 150, 29);
|
||||
gtk_widget_add_accelerator (vmode3dcombo, "grab_focus", accel_group,
|
||||
GDK_V, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
// Fullscreen checkbox
|
||||
fullscreencheck = gtk_check_button_new_with_mnemonic ("_Fullscreen");
|
||||
gtk_widget_show (fullscreencheck);
|
||||
gtk_fixed_put (GTK_FIXED (configlayout), fullscreencheck, 248, 0);
|
||||
gtk_widget_set_size_request (fullscreencheck, 85, 29);
|
||||
gtk_widget_add_accelerator (fullscreencheck, "grab_focus", accel_group,
|
||||
GDK_F, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
// Always show config checkbox
|
||||
alwaysshowcheck = gtk_check_button_new_with_mnemonic ("_Always show configuration on start");
|
||||
gtk_widget_show (alwaysshowcheck);
|
||||
gtk_box_pack_start (GTK_BOX (configvlayout), alwaysshowcheck, FALSE, FALSE, 0);
|
||||
gtk_widget_add_accelerator (alwaysshowcheck, "grab_focus", accel_group,
|
||||
GDK_A, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
// Configuration tab
|
||||
configtab = gtk_label_new ("Configuration");
|
||||
gtk_widget_show (configtab);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (tabs), gtk_notebook_get_nth_page (GTK_NOTEBOOK (tabs), 0), configtab);
|
||||
|
||||
// Messages scrollable area
|
||||
messagesscroll = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (messagesscroll);
|
||||
gtk_container_add (GTK_CONTAINER (tabs), messagesscroll);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (messagesscroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
||||
|
||||
// Messages text area
|
||||
messagestext = gtk_text_view_new ();
|
||||
gtk_widget_show (messagestext);
|
||||
gtk_container_add (GTK_CONTAINER (messagesscroll), messagestext);
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (messagestext), FALSE);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (messagestext), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (messagestext), FALSE);
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (messagestext), 2);
|
||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (messagestext), 2);
|
||||
|
||||
// Messages tab
|
||||
messagestab = gtk_label_new ("Messages");
|
||||
gtk_widget_show (messagestab);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (tabs), gtk_notebook_get_nth_page (GTK_NOTEBOOK (tabs), 1), messagestab);
|
||||
|
||||
// Dialogue box buttons layout
|
||||
buttons = gtk_hbutton_box_new ();
|
||||
gtk_widget_show (buttons);
|
||||
gtk_box_pack_start (GTK_BOX (vlayout), buttons, FALSE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (buttons), 3);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (buttons), GTK_BUTTONBOX_END);
|
||||
|
||||
// Cancel button
|
||||
cancelbutton = gtk_button_new ();
|
||||
gtk_widget_show (cancelbutton);
|
||||
gtk_container_add (GTK_CONTAINER (buttons), cancelbutton);
|
||||
GTK_WIDGET_SET_FLAGS (cancelbutton, GTK_CAN_DEFAULT);
|
||||
gtk_widget_add_accelerator (cancelbutton, "grab_focus", accel_group,
|
||||
GDK_C, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_widget_add_accelerator (cancelbutton, "clicked", accel_group,
|
||||
GDK_Escape, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
cancelbuttonalign = gtk_alignment_new (0.5, 0.5, 0, 0);
|
||||
gtk_widget_show (cancelbuttonalign);
|
||||
gtk_container_add (GTK_CONTAINER (cancelbutton), cancelbuttonalign);
|
||||
|
||||
cancelbuttonlayout = gtk_hbox_new (FALSE, 2);
|
||||
gtk_widget_show (cancelbuttonlayout);
|
||||
gtk_container_add (GTK_CONTAINER (cancelbuttonalign), cancelbuttonlayout);
|
||||
|
||||
cancelbuttonicon = gtk_image_new_from_stock ("gtk-cancel", GTK_ICON_SIZE_BUTTON);
|
||||
gtk_widget_show (cancelbuttonicon);
|
||||
gtk_box_pack_start (GTK_BOX (cancelbuttonlayout), cancelbuttonicon, FALSE, FALSE, 0);
|
||||
|
||||
cancelbuttonlabel = gtk_label_new_with_mnemonic ("_Cancel");
|
||||
gtk_widget_show (cancelbuttonlabel);
|
||||
gtk_box_pack_start (GTK_BOX (cancelbuttonlayout), cancelbuttonlabel, FALSE, FALSE, 0);
|
||||
|
||||
// Start button
|
||||
startbutton = gtk_button_new ();
|
||||
gtk_widget_show (startbutton);
|
||||
gtk_container_add (GTK_CONTAINER (buttons), startbutton);
|
||||
GTK_WIDGET_SET_FLAGS (startbutton, GTK_CAN_DEFAULT);
|
||||
gtk_widget_add_accelerator (startbutton, "grab_focus", accel_group,
|
||||
GDK_S, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_widget_add_accelerator (startbutton, "clicked", accel_group,
|
||||
GDK_Return, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
startbuttonalign = gtk_alignment_new (0.5, 0.5, 0, 0);
|
||||
gtk_widget_show (startbuttonalign);
|
||||
gtk_container_add (GTK_CONTAINER (startbutton), startbuttonalign);
|
||||
|
||||
startbuttonlayout = gtk_hbox_new (FALSE, 2);
|
||||
gtk_widget_show (startbuttonlayout);
|
||||
gtk_container_add (GTK_CONTAINER (startbuttonalign), startbuttonlayout);
|
||||
|
||||
startbuttonicon = gtk_image_new_from_stock ("gtk-execute", GTK_ICON_SIZE_BUTTON);
|
||||
gtk_widget_show (startbuttonicon);
|
||||
gtk_box_pack_start (GTK_BOX (startbuttonlayout), startbuttonicon, FALSE, FALSE, 0);
|
||||
|
||||
startbuttonlabel = gtk_label_new_with_mnemonic ("_Start");
|
||||
gtk_widget_show (startbuttonlabel);
|
||||
gtk_box_pack_start (GTK_BOX (startbuttonlayout), startbuttonlabel, FALSE, FALSE, 0);
|
||||
|
||||
// Wire up the signals
|
||||
g_signal_connect ((gpointer) startwin, "delete_event",
|
||||
G_CALLBACK (on_startwin_delete_event),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) vmode3dcombo, "changed",
|
||||
G_CALLBACK (on_vmode3dcombo_changed),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) fullscreencheck, "toggled",
|
||||
G_CALLBACK (on_fullscreencheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) alwaysshowcheck, "toggled",
|
||||
G_CALLBACK (on_alwaysshowcheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) cancelbutton, "clicked",
|
||||
G_CALLBACK (on_cancelbutton_clicked),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) startbutton, "clicked",
|
||||
G_CALLBACK (on_startbutton_clicked),
|
||||
NULL);
|
||||
|
||||
// Associate labels with their controls
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (vmode3dlabel), vmode3dcombo);
|
||||
|
||||
/* Store pointers to all widgets, for use by lookup_widget(). */
|
||||
GLADE_HOOKUP_OBJECT_NO_REF (startwin, startwin, "startwin");
|
||||
GLADE_HOOKUP_OBJECT (startwin, hlayout, "hlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, banner, "banner");
|
||||
GLADE_HOOKUP_OBJECT (startwin, vlayout, "vlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, tabs, "tabs");
|
||||
GLADE_HOOKUP_OBJECT (startwin, configvlayout, "configvlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, configlayout, "configlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, vmode3dlabel, "vmode3dlabel");
|
||||
GLADE_HOOKUP_OBJECT (startwin, vmode3dcombo, "vmode3dcombo");
|
||||
GLADE_HOOKUP_OBJECT (startwin, fullscreencheck, "fullscreencheck");
|
||||
GLADE_HOOKUP_OBJECT (startwin, alwaysshowcheck, "alwaysshowcheck");
|
||||
GLADE_HOOKUP_OBJECT (startwin, configtab, "configtab");
|
||||
GLADE_HOOKUP_OBJECT (startwin, messagesscroll, "messagesscroll");
|
||||
GLADE_HOOKUP_OBJECT (startwin, messagestext, "messagestext");
|
||||
GLADE_HOOKUP_OBJECT (startwin, messagestab, "messagestab");
|
||||
GLADE_HOOKUP_OBJECT (startwin, buttons, "buttons");
|
||||
GLADE_HOOKUP_OBJECT (startwin, cancelbutton, "cancelbutton");
|
||||
GLADE_HOOKUP_OBJECT (startwin, cancelbuttonalign, "cancelbuttonalign");
|
||||
GLADE_HOOKUP_OBJECT (startwin, cancelbuttonlayout, "cancelbuttonlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, cancelbuttonicon, "cancelbuttonicon");
|
||||
GLADE_HOOKUP_OBJECT (startwin, cancelbuttonlabel, "cancelbuttonlabel");
|
||||
GLADE_HOOKUP_OBJECT (startwin, startbutton, "startbutton");
|
||||
GLADE_HOOKUP_OBJECT (startwin, startbuttonalign, "startbuttonalign");
|
||||
GLADE_HOOKUP_OBJECT (startwin, startbuttonlayout, "startbuttonlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, startbuttonicon, "startbuttonicon");
|
||||
GLADE_HOOKUP_OBJECT (startwin, startbuttonlabel, "startbuttonlabel");
|
||||
|
||||
gtk_window_add_accel_group (GTK_WINDOW (startwin), accel_group);
|
||||
|
||||
return startwin;
|
||||
}
|
||||
|
||||
// -- BUILD ENTRY POINTS ------------------------------------------------------
|
||||
|
||||
int startwin_open(void)
|
||||
{
|
||||
if (!gtkenabled) return 0;
|
||||
if (startwin) return 1;
|
||||
|
||||
startwin = create_window();
|
||||
if (startwin) {
|
||||
SetPage(TAB_MESSAGES);
|
||||
gtk_widget_show(startwin);
|
||||
gtk_main_iteration_do(FALSE);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int startwin_close(void)
|
||||
{
|
||||
if (!gtkenabled) return 0;
|
||||
if (!startwin) return 1;
|
||||
gtk_widget_destroy (startwin);
|
||||
startwin = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_puts(const char *str)
|
||||
{
|
||||
GtkWidget *textview;
|
||||
GtkTextBuffer *textbuffer;
|
||||
GtkTextIter enditer;
|
||||
GtkTextMark *mark;
|
||||
const char *aptr, *bptr;
|
||||
|
||||
if (!gtkenabled || !str) return 0;
|
||||
if (!startwin) return 1;
|
||||
if (!(textview = lookup_widget(startwin, "messagestext"))) return -1;
|
||||
textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
|
||||
|
||||
gtk_text_buffer_get_end_iter(textbuffer, &enditer);
|
||||
for (aptr = bptr = str; *aptr != 0; ) {
|
||||
switch (*bptr) {
|
||||
case '\b':
|
||||
if (bptr > aptr)
|
||||
gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1);
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE);
|
||||
#else
|
||||
{
|
||||
GtkTextIter iter2 = enditer;
|
||||
gtk_text_iter_backward_cursor_position(&iter2);
|
||||
//FIXME: this seems be deleting one too many chars somewhere!
|
||||
if (!gtk_text_iter_equal(&iter2, &enditer))
|
||||
gtk_text_buffer_delete_interactive(textbuffer, &iter2, &enditer, TRUE);
|
||||
}
|
||||
#endif
|
||||
aptr = ++bptr;
|
||||
break;
|
||||
case 0:
|
||||
if (bptr > aptr)
|
||||
gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr));
|
||||
aptr = bptr;
|
||||
break;
|
||||
case '\r': // FIXME
|
||||
default:
|
||||
bptr++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mark = gtk_text_buffer_create_mark(textbuffer, NULL, &enditer, 1);
|
||||
gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textview), mark, 0.0, FALSE, 0.0, 1.0);
|
||||
gtk_text_buffer_delete_mark(textbuffer, mark);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_settitle(const char *title)
|
||||
{
|
||||
if (!gtkenabled) return 0;
|
||||
if (!startwin) return 1;
|
||||
gtk_window_set_title (GTK_WINDOW (startwin), title);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_idle(void *s)
|
||||
{
|
||||
if (!gtkenabled) return 0;
|
||||
//if (!startwin) return 1;
|
||||
gtk_main_iteration_do (FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int xdimgame, ydimgame, bppgame, forcesetup;
|
||||
|
||||
int startwin_run(void)
|
||||
{
|
||||
if (!gtkenabled) return 0;
|
||||
if (!startwin) return 1;
|
||||
|
||||
SetPage(TAB_CONFIG);
|
||||
|
||||
settings.fullscreen = fullscreen;
|
||||
settings.xdim3d = xdimgame;
|
||||
settings.ydim3d = ydimgame;
|
||||
settings.bpp3d = bppgame;
|
||||
settings.forcesetup = forcesetup;
|
||||
PopulateForm();
|
||||
|
||||
gtk_main();
|
||||
|
||||
SetPage(TAB_MESSAGES);
|
||||
if (retval) {
|
||||
fullscreen = settings.fullscreen;
|
||||
xdimgame = settings.xdim3d;
|
||||
ydimgame = settings.ydim3d;
|
||||
bppgame = settings.bpp3d;
|
||||
forcesetup = settings.forcesetup;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
422
polymer/build/game/startwin.game.c
Executable file
422
polymer/build/game/startwin.game.c
Executable file
|
@ -0,0 +1,422 @@
|
|||
#ifndef RENDERTYPEWIN
|
||||
#error Only for Windows
|
||||
#endif
|
||||
|
||||
#include "build.h"
|
||||
#include "winlayer.h"
|
||||
#include "compat.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#define _WIN32_IE 0x0300
|
||||
#include <commctrl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "startwin.game.h"
|
||||
|
||||
#define TAB_CONFIG 0
|
||||
#define TAB_MESSAGES 1
|
||||
|
||||
static struct {
|
||||
int fullscreen;
|
||||
int xdim3d, ydim3d, bpp3d;
|
||||
int forcesetup;
|
||||
} settings;
|
||||
|
||||
static HWND startupdlg = NULL;
|
||||
static HWND pages[2] = { NULL, NULL};
|
||||
static int done = -1, mode = TAB_CONFIG;
|
||||
|
||||
static void PopulateForm(void)
|
||||
{
|
||||
int i,j;
|
||||
char buf[64];
|
||||
int mode3d;
|
||||
HWND hwnd3d;
|
||||
|
||||
hwnd3d = GetDlgItem(pages[TAB_CONFIG], IDC3DVMODE);
|
||||
|
||||
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1);
|
||||
if (mode3d < 0) {
|
||||
int cd[] = { 32, 24, 16, 15, 8, 0 };
|
||||
for (i=0; cd[i]; ) { if (cd[i] >= settings.bpp3d) i++; else break; }
|
||||
for ( ; cd[i]; i++) {
|
||||
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1);
|
||||
if (mode3d < 0) continue;
|
||||
settings.bpp3d = cd[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), (settings.fullscreen ? BST_CHECKED : BST_UNCHECKED));
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCALWAYSSHOW), (settings.forcesetup ? BST_CHECKED : BST_UNCHECKED));
|
||||
|
||||
ComboBox_ResetContent(hwnd3d);
|
||||
for (i=0; i<validmodecnt; i++) {
|
||||
if (validmode[i].fs != settings.fullscreen) continue;
|
||||
|
||||
// all modes get added to the 3D mode list
|
||||
Bsprintf(buf, "%ld x %ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
|
||||
j = ComboBox_AddString(hwnd3d, buf);
|
||||
ComboBox_SetItemData(hwnd3d, j, i);
|
||||
if (i == mode3d) ComboBox_SetCurSel(hwnd3d, j);
|
||||
}
|
||||
}
|
||||
|
||||
static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (uMsg) {
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDCFULLSCREEN:
|
||||
settings.fullscreen = !settings.fullscreen;
|
||||
PopulateForm();
|
||||
return TRUE;
|
||||
case IDC3DVMODE:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE) {
|
||||
int i;
|
||||
i = ComboBox_GetCurSel((HWND)lParam);
|
||||
if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
|
||||
if (i != CB_ERR) {
|
||||
settings.xdim3d = validmode[i].xdim;
|
||||
settings.ydim3d = validmode[i].ydim;
|
||||
settings.bpp3d = validmode[i].bpp;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
case IDCALWAYSSHOW:
|
||||
settings.forcesetup = IsDlgButtonChecked(hwndDlg, IDCALWAYSSHOW) == BST_CHECKED;
|
||||
return TRUE;
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void SetPage(int n)
|
||||
{
|
||||
HWND tab;
|
||||
int cur;
|
||||
tab = GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL);
|
||||
cur = (int)SendMessage(tab, TCM_GETCURSEL,0,0);
|
||||
ShowWindow(pages[cur],SW_HIDE);
|
||||
SendMessage(tab, TCM_SETCURSEL, n, 0);
|
||||
ShowWindow(pages[n],SW_SHOW);
|
||||
mode = n;
|
||||
|
||||
SetFocus(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL));
|
||||
}
|
||||
|
||||
static void EnableConfig(int n)
|
||||
{
|
||||
//EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_CANCEL), n);
|
||||
EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_START), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDC3DVMODE), n);
|
||||
}
|
||||
|
||||
static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static HBITMAP hbmp = NULL;
|
||||
HDC hdc;
|
||||
|
||||
switch (uMsg) {
|
||||
case WM_INITDIALOG: {
|
||||
HWND hwnd;
|
||||
RECT r, rdlg, chrome, rtab, rcancel, rstart;
|
||||
int xoffset = 0, yoffset = 0;
|
||||
|
||||
// Fetch the positions (in screen coordinates) of all the windows we need to tweak
|
||||
ZeroMemory(&chrome, sizeof(chrome));
|
||||
AdjustWindowRect(&chrome, GetWindowLong(hwndDlg, GWL_STYLE), FALSE);
|
||||
GetWindowRect(hwndDlg, &rdlg);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), &rtab);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), &rcancel);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_START), &rstart);
|
||||
|
||||
// Knock off the non-client area of the main dialogue to give just the client area
|
||||
rdlg.left -= chrome.left; rdlg.top -= chrome.top;
|
||||
rdlg.right -= chrome.right; rdlg.bottom -= chrome.bottom;
|
||||
|
||||
// Translate them to client-relative coordinates wrt the main dialogue window
|
||||
rtab.right -= rtab.left - 1; rtab.bottom -= rtab.top - 1;
|
||||
rtab.left -= rdlg.left; rtab.top -= rdlg.top;
|
||||
|
||||
rcancel.right -= rcancel.left - 1; rcancel.bottom -= rcancel.top - 1;
|
||||
rcancel.left -= rdlg.left; rcancel.top -= rdlg.top;
|
||||
|
||||
rstart.right -= rstart.left - 1; rstart.bottom -= rstart.top - 1;
|
||||
rstart.left -= rdlg.left; rstart.top -= rdlg.top;
|
||||
|
||||
// And then convert the main dialogue coordinates to just width/length
|
||||
rdlg.right -= rdlg.left - 1; rdlg.bottom -= rdlg.top - 1;
|
||||
rdlg.left = 0; rdlg.top = 0;
|
||||
|
||||
// Load the bitmap into the bitmap control and fetch its dimensions
|
||||
hbmp = LoadBitmap((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(RSRC_BMP));
|
||||
hwnd = GetDlgItem(hwndDlg,WIN_STARTWIN_BITMAP);
|
||||
SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp);
|
||||
GetClientRect(hwnd, &r);
|
||||
xoffset = r.right;
|
||||
yoffset = r.bottom - rdlg.bottom;
|
||||
|
||||
// Shift and resize the controls that require it
|
||||
rtab.left += xoffset; rtab.bottom += yoffset;
|
||||
rcancel.left += xoffset; rcancel.top += yoffset;
|
||||
rstart.left += xoffset; rstart.top += yoffset;
|
||||
rdlg.right += xoffset;
|
||||
rdlg.bottom += yoffset;
|
||||
|
||||
// Move the controls to their new positions
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), rtab.left, rtab.top, rtab.right, rtab.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), rcancel.left, rcancel.top, rcancel.right, rcancel.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_START), rstart.left, rstart.top, rstart.right, rstart.bottom, FALSE);
|
||||
|
||||
// Move the main dialogue to the centre of the screen
|
||||
hdc = GetDC(NULL);
|
||||
rdlg.left = (GetDeviceCaps(hdc, HORZRES) - rdlg.right) / 2;
|
||||
rdlg.top = (GetDeviceCaps(hdc, VERTRES) - rdlg.bottom) / 2;
|
||||
ReleaseDC(NULL, hdc);
|
||||
MoveWindow(hwndDlg, rdlg.left + chrome.left, rdlg.top + chrome.left,
|
||||
rdlg.right + (-chrome.left+chrome.right), rdlg.bottom + (-chrome.top+chrome.bottom), TRUE);
|
||||
|
||||
// Add tabs to the tab control
|
||||
{
|
||||
TCITEM tab;
|
||||
|
||||
hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL);
|
||||
|
||||
ZeroMemory(&tab, sizeof(tab));
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Configuration");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)0, (LPARAM)&tab);
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Messages");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)1, (LPARAM)&tab);
|
||||
|
||||
// Work out the position and size of the area inside the tab control for the pages
|
||||
ZeroMemory(&r, sizeof(r));
|
||||
GetClientRect(hwnd, &r);
|
||||
SendMessage(hwnd, TCM_ADJUSTRECT, FALSE, (LPARAM)&r);
|
||||
r.right -= r.left-1;
|
||||
r.bottom -= r.top-1;
|
||||
r.top += rtab.top;
|
||||
r.left += rtab.left;
|
||||
|
||||
// Create the pages and position them in the tab control, but hide them
|
||||
pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(),
|
||||
MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc);
|
||||
pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES);
|
||||
SetWindowPos(pages[TAB_CONFIG], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
SetWindowPos(pages[TAB_MESSAGES], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
|
||||
// Tell the editfield acting as the console to exclude the width of the scrollbar
|
||||
GetClientRect(pages[TAB_MESSAGES],&r);
|
||||
r.right -= GetSystemMetrics(SM_CXVSCROLL)+4;
|
||||
r.left = r.top = 0;
|
||||
SendMessage(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r);
|
||||
|
||||
SetFocus(GetDlgItem(hwndDlg, WIN_STARTWIN_START));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
case WM_NOTIFY: {
|
||||
LPNMHDR nmhdr = (LPNMHDR)lParam;
|
||||
int cur;
|
||||
if (nmhdr->idFrom != WIN_STARTWIN_TABCTL) break;
|
||||
cur = (int)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0);
|
||||
switch (nmhdr->code) {
|
||||
case TCN_SELCHANGING: {
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_HIDE);
|
||||
return TRUE;
|
||||
}
|
||||
case TCN_SELCHANGE: {
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_SHOW);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_CLOSE:
|
||||
if (mode == TAB_CONFIG) done = 0;
|
||||
else quitevent++;
|
||||
return TRUE;
|
||||
|
||||
case WM_DESTROY:
|
||||
if (hbmp) {
|
||||
DeleteObject(hbmp);
|
||||
hbmp = NULL;
|
||||
}
|
||||
|
||||
if (pages[TAB_CONFIG]) {
|
||||
DestroyWindow(pages[TAB_CONFIG]);
|
||||
pages[TAB_CONFIG] = NULL;
|
||||
}
|
||||
|
||||
startupdlg = NULL;
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case WIN_STARTWIN_CANCEL:
|
||||
if (mode == TAB_CONFIG) done = 0;
|
||||
else quitevent++;
|
||||
return TRUE;
|
||||
case WIN_STARTWIN_START: done = 1; return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
case WM_CTLCOLORSTATIC:
|
||||
if ((HWND)lParam == pages[TAB_MESSAGES])
|
||||
return (BOOL)GetSysColorBrush(COLOR_WINDOW);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
int startwin_open(void)
|
||||
{
|
||||
INITCOMMONCONTROLSEX icc;
|
||||
if (startupdlg) return 1;
|
||||
icc.dwSize = sizeof(icc);
|
||||
icc.dwICC = ICC_TAB_CLASSES;
|
||||
InitCommonControlsEx(&icc);
|
||||
startupdlg = CreateDialog((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(WIN_STARTWIN), NULL, startup_dlgproc);
|
||||
if (startupdlg) {
|
||||
SetPage(TAB_MESSAGES);
|
||||
EnableConfig(0);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int startwin_close(void)
|
||||
{
|
||||
if (!startupdlg) return 1;
|
||||
DestroyWindow(startupdlg);
|
||||
startupdlg = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_puts(const char *buf)
|
||||
{
|
||||
const char *p = NULL, *q = NULL;
|
||||
char workbuf[1024];
|
||||
static int newline = 0;
|
||||
int curlen, linesbefore, linesafter;
|
||||
HWND edctl;
|
||||
int vis;
|
||||
|
||||
if (!startupdlg) return 1;
|
||||
|
||||
edctl = pages[TAB_MESSAGES];
|
||||
if (!edctl) return -1;
|
||||
|
||||
vis = ((int)SendMessage(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL), TCM_GETCURSEL,0,0) == TAB_MESSAGES);
|
||||
|
||||
if (vis) SendMessage(edctl, WM_SETREDRAW, FALSE,0);
|
||||
curlen = SendMessage(edctl, WM_GETTEXTLENGTH, 0,0);
|
||||
SendMessage(edctl, EM_SETSEL, (WPARAM)curlen, (LPARAM)curlen);
|
||||
linesbefore = SendMessage(edctl, EM_GETLINECOUNT, 0,0);
|
||||
p = buf;
|
||||
while (*p) {
|
||||
if (newline) {
|
||||
SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)"\r\n");
|
||||
newline = 0;
|
||||
}
|
||||
q = p;
|
||||
while (*q && *q != '\n') q++;
|
||||
memcpy(workbuf, p, q-p);
|
||||
if (*q == '\n') {
|
||||
if (!q[1]) {
|
||||
newline = 1;
|
||||
workbuf[q-p] = 0;
|
||||
} else {
|
||||
workbuf[q-p] = '\r';
|
||||
workbuf[q-p+1] = '\n';
|
||||
workbuf[q-p+2] = 0;
|
||||
}
|
||||
p = q+1;
|
||||
} else {
|
||||
workbuf[q-p] = 0;
|
||||
p = q;
|
||||
}
|
||||
SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)workbuf);
|
||||
}
|
||||
linesafter = SendMessage(edctl, EM_GETLINECOUNT, 0,0);
|
||||
SendMessage(edctl, EM_LINESCROLL, 0, linesafter-linesbefore);
|
||||
if (vis) SendMessage(edctl, WM_SETREDRAW, TRUE,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_settitle(const char *str)
|
||||
{
|
||||
if (!startupdlg) return 1;
|
||||
SetWindowText(startupdlg, str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_idle(void *v)
|
||||
{
|
||||
if (!startupdlg || !IsWindow(startupdlg)) return 0;
|
||||
if (IsDialogMessage(startupdlg, (MSG*)v)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int xdimgame, ydimgame, bppgame, forcesetup;
|
||||
|
||||
int startwin_run(void)
|
||||
{
|
||||
MSG msg;
|
||||
if (!startupdlg) return 1;
|
||||
|
||||
done = -1;
|
||||
|
||||
SetPage(TAB_CONFIG);
|
||||
EnableConfig(1);
|
||||
|
||||
settings.fullscreen = fullscreen;
|
||||
settings.xdim3d = xdimgame;
|
||||
settings.ydim3d = ydimgame;
|
||||
settings.bpp3d = bppgame;
|
||||
settings.forcesetup = forcesetup;
|
||||
PopulateForm();
|
||||
|
||||
while (done < 0) {
|
||||
switch (GetMessage(&msg, NULL, 0,0)) {
|
||||
case 0: done = 1; break;
|
||||
case -1: return -1;
|
||||
default:
|
||||
if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) break;
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SetPage(TAB_MESSAGES);
|
||||
EnableConfig(0);
|
||||
if (done) {
|
||||
fullscreen = settings.fullscreen;
|
||||
xdimgame = settings.xdim3d;
|
||||
ydimgame = settings.ydim3d;
|
||||
bppgame = settings.bpp3d;
|
||||
forcesetup = settings.forcesetup;
|
||||
}
|
||||
|
||||
return done;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,574 +0,0 @@
|
|||
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
||||
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
||||
// See the included license file "BUILDLIC.TXT" for license info.
|
||||
//
|
||||
// This file has been modified from Ken Silverman's original release
|
||||
// by Jonathon Fowler (jonof@edgenetwk.com)
|
||||
|
||||
#include "compat.h"
|
||||
#include "a.h"
|
||||
#include "build.h"
|
||||
#include "editor.h"
|
||||
#include "pragmas.h"
|
||||
#include "baselayer.h"
|
||||
#include "names.h"
|
||||
#include "osd.h"
|
||||
#include "cache1d.h"
|
||||
|
||||
|
||||
static char tempbuf[256];
|
||||
|
||||
#define NUMOPTIONS 9
|
||||
char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
|
||||
char keys[NUMBUILDKEYS] =
|
||||
{
|
||||
0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39,
|
||||
0x1e,0x2c,0xd1,0xc9,0x33,0x34,
|
||||
0x9c,0x1c,0xd,0xc,0xf,0x45
|
||||
};
|
||||
|
||||
|
||||
|
||||
//static long hang = 0;
|
||||
//static long rollangle = 0;
|
||||
|
||||
//Detecting 2D / 3D mode:
|
||||
// qsetmode is 200 in 3D mode
|
||||
// qsetmode is 350/480 in 2D mode
|
||||
//
|
||||
//You can read these variables when F5-F8 is pressed in 3D mode only:
|
||||
//
|
||||
// If (searchstat == 0) WALL searchsector=sector, searchwall=wall
|
||||
// If (searchstat == 1) CEILING searchsector=sector
|
||||
// If (searchstat == 2) FLOOR searchsector=sector
|
||||
// If (searchstat == 3) SPRITE searchsector=sector, searchwall=sprite
|
||||
// If (searchstat == 4) MASKED WALL searchsector=sector, searchwall=wall
|
||||
//
|
||||
// searchsector is the sector of the selected item for all 5 searchstat's
|
||||
//
|
||||
// searchwall is undefined if searchstat is 1 or 2
|
||||
// searchwall is the wall if searchstat = 0 or 4
|
||||
// searchwall is the sprite if searchstat = 3 (Yeah, I know - it says wall,
|
||||
// but trust me, it's the sprite number)
|
||||
|
||||
long averagefps;
|
||||
#define AVERAGEFRAMES 32
|
||||
static unsigned long frameval[AVERAGEFRAMES];
|
||||
static long framecnt = 0;
|
||||
|
||||
char *defsfilename = "kenbuild.def";
|
||||
char *startwin_labeltext = "Starting Build Editor...";
|
||||
int nextvoxid = 0;
|
||||
|
||||
int ExtPreInit(int *argc,char ***argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ExtInit(void)
|
||||
{
|
||||
long i, rv = 0;
|
||||
|
||||
/*printf("------------------------------------------------------------------------------\n");
|
||||
printf(" BUILD.EXE copyright(c) 1996 by Ken Silverman. You are granted the\n");
|
||||
printf(" right to use this software for your personal use only. This is a\n");
|
||||
printf(" special version to be used with \"Happy Fun KenBuild\" and may not work\n");
|
||||
printf(" properly with other Build engine games. Please refer to license.doc\n");
|
||||
printf(" for distribution rights\n");
|
||||
printf("------------------------------------------------------------------------------\n");
|
||||
getch();
|
||||
*/
|
||||
|
||||
initgroupfile("stuff.dat");
|
||||
bpp = 8;
|
||||
if (loadsetup("build.cfg") < 0) initprintf("Configuration file not found, using defaults.\n"), rv = 1;
|
||||
Bmemcpy((void *)buildkeys,(void *)keys,NUMBUILDKEYS); //Trick to make build use setup.dat keys
|
||||
if (option[4] > 0) option[4] = 0;
|
||||
if (initengine()) {
|
||||
wm_msgbox("Build Engine Initialisation Error",
|
||||
"There was a problem initialising the Build engine: %s", engineerrstr);
|
||||
return -1;
|
||||
}
|
||||
initinput();
|
||||
initmouse();
|
||||
|
||||
//You can load your own palette lookup tables here if you just
|
||||
//copy the right code!
|
||||
for(i=0;i<256;i++)
|
||||
tempbuf[i] = ((i+32)&255); //remap colors for screwy palette sectors
|
||||
makepalookup(16,tempbuf,0,0,0,1);
|
||||
|
||||
kensplayerheight = 32;
|
||||
zmode = 0;
|
||||
defaultspritecstat = 0;
|
||||
pskyoff[0] = 0; pskyoff[1] = 0; pskybits = 1;
|
||||
|
||||
#ifdef SUPERBUILD
|
||||
tiletovox[PLAYER] = nextvoxid++;
|
||||
tiletovox[BROWNMONSTER] = nextvoxid++;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
// allowtaskswitching(0);
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
void ExtUnInit(void)
|
||||
{
|
||||
uninitgroupfile();
|
||||
writesetup("build.cfg");
|
||||
}
|
||||
|
||||
void ExtSetupSpecialSpriteCols(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//static long daviewingrange, daaspect, horizval1, horizval2;
|
||||
void ExtPreCheckKeys(void)
|
||||
{
|
||||
long /*cosang, sinang, dx, dy, mindx,*/ i, j, k;
|
||||
|
||||
if (keystatus[0x3e]) //F4 - screen re-size
|
||||
{
|
||||
keystatus[0x3e] = 0;
|
||||
|
||||
//cycle through all vesa modes, then screen-buffer mode
|
||||
if (keystatus[0x2a]|keystatus[0x36]) {
|
||||
setgamemode(!fullscreen, xdim, ydim, bpp);
|
||||
} else {
|
||||
|
||||
//cycle through all modes
|
||||
j=-1;
|
||||
|
||||
// work out a mask to select the mode
|
||||
for (i=0; i<validmodecnt; i++)
|
||||
if ((validmode[i].xdim == xdim) &&
|
||||
(validmode[i].ydim == ydim) &&
|
||||
(validmode[i].fs == fullscreen) &&
|
||||
(validmode[i].bpp == bpp))
|
||||
{ j=i; break; }
|
||||
|
||||
for (k=0; k<validmodecnt; k++)
|
||||
if (validmode[k].fs == fullscreen && validmode[k].bpp == bpp) break;
|
||||
|
||||
if (j==-1) j=k;
|
||||
else {
|
||||
j++;
|
||||
if (j==validmodecnt) j=k;
|
||||
}
|
||||
setgamemode(fullscreen,validmode[j].xdim,validmode[j].ydim,bpp);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (keystatus[0x2a]|keystatus[0x36])
|
||||
{
|
||||
if (keystatus[0xcf]) hang = max(hang-1,-182);
|
||||
if (keystatus[0xc7]) hang = min(hang+1,182);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (keystatus[0xcf]) hang = max(hang-8,-182);
|
||||
if (keystatus[0xc7]) hang = min(hang+8,182);
|
||||
}
|
||||
if (keystatus[0x4c]) { hang = 0; horiz = 100; }
|
||||
if (hang != 0)
|
||||
{
|
||||
walock[4094] = 255;
|
||||
|
||||
// JBF 20031117: scale each dimension by a factor of 1.2, and work out
|
||||
// the aspect of the screen. Anywhere you see 'i' below was the value
|
||||
// '200' before I changed it. NOTE: This whole trick crashes in resolutions
|
||||
// above 800x600. I'm not sure why, and fixing it is not something I intend
|
||||
// to do in a real big hurry.
|
||||
dx = (xdim + (xdim >> 3) + (xdim >> 4) + (xdim >> 6)) & (~7);
|
||||
dy = (ydim + (ydim >> 3) + (ydim >> 4) + (ydim >> 6)) & (~7);
|
||||
i = scale(320,ydim,xdim);
|
||||
|
||||
if (waloff[4094] == 0) allocache(&waloff[4094],/*240L*384L*/dx*dy,&walock[4094]);
|
||||
setviewtotile(4094,/*240L,384L*/dy,dx);
|
||||
|
||||
cosang = sintable[(hang+512)&2047];
|
||||
sinang = sintable[hang&2047];
|
||||
|
||||
dx = dmulscale1(320,cosang,i,sinang); mindx = dx;
|
||||
dy = dmulscale1(-i,cosang,320,sinang);
|
||||
horizval1 = dy*(320>>1)/dx-1;
|
||||
|
||||
dx = dmulscale1(320,cosang,-i,sinang); mindx = min(dx,mindx);
|
||||
dy = dmulscale1(i,cosang,320,sinang);
|
||||
horizval2 = dy*(320>>1)/dx+1;
|
||||
|
||||
daviewingrange = scale(65536,16384*(xdim>>1),mindx-16);
|
||||
daaspect = scale(daviewingrange,scale(320,tilesizx[4094],tilesizy[4094]),horizval2+6-horizval1);
|
||||
setaspect(daviewingrange,scale(daaspect,ydim*320,xdim*i));
|
||||
horiz = 100-divscale15(horizval1+horizval2,daviewingrange);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SUPERBUILD
|
||||
#define MAXVOXMIPS 5
|
||||
extern char *voxoff[][MAXVOXMIPS];
|
||||
void ExtAnalyzeSprites(void)
|
||||
{
|
||||
long i, *longptr;
|
||||
spritetype *tspr;
|
||||
|
||||
for(i=0,tspr=&tsprite[0];i<spritesortcnt;i++,tspr++)
|
||||
{
|
||||
if (usevoxels && tiletovox[tspr->picnum] >= 0)
|
||||
{
|
||||
switch(tspr->picnum)
|
||||
{
|
||||
case PLAYER:
|
||||
if (!voxoff[ tiletovox[PLAYER] ][0]) {
|
||||
if (qloadkvx(tiletovox[PLAYER],"voxel000.kvx")) {
|
||||
tiletovox[PLAYER] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//tspr->cstat |= 48; tspr->picnum = tiletovox[tspr->picnum];
|
||||
longptr = (long *)voxoff[ tiletovox[PLAYER] ][0];
|
||||
tspr->xrepeat = scale(tspr->xrepeat,56,longptr[2]);
|
||||
tspr->yrepeat = scale(tspr->yrepeat,56,longptr[2]);
|
||||
tspr->shade -= 6;
|
||||
break;
|
||||
case BROWNMONSTER:
|
||||
if (!voxoff[ tiletovox[BROWNMONSTER] ][0]) {
|
||||
if (qloadkvx(tiletovox[BROWNMONSTER],"voxel001.kvx")) {
|
||||
tiletovox[BROWNMONSTER] = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//tspr->cstat |= 48; tspr->picnum = tiletovox[tspr->picnum];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tspr->shade += 6;
|
||||
if (sector[tspr->sectnum].ceilingstat&1)
|
||||
tspr->shade += sector[tspr->sectnum].ceilingshade;
|
||||
else
|
||||
tspr->shade += sector[tspr->sectnum].floorshade;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void ExtCheckKeys(void)
|
||||
{
|
||||
long i;//, p, y, dx, dy, cosang, sinang, bufplc, tsizy, tsizyup15;
|
||||
long j;
|
||||
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
#if 0
|
||||
if (hang != 0)
|
||||
{
|
||||
bufplc = waloff[4094]+(mulscale16(horiz-100,xdimenscale)+(tilesizx[4094]>>1))*tilesizy[4094];
|
||||
setviewback();
|
||||
cosang = sintable[(hang+512)&2047];
|
||||
sinang = sintable[hang&2047];
|
||||
dx = dmulscale1(xdim,cosang,ydim,sinang);
|
||||
dy = dmulscale1(-ydim,cosang,xdim,sinang);
|
||||
|
||||
begindrawing();
|
||||
tsizy = tilesizy[4094];
|
||||
tsizyup15 = (tsizy<<15);
|
||||
dx = mulscale14(dx,daviewingrange);
|
||||
dy = mulscale14(dy,daaspect);
|
||||
sinang = mulscale14(sinang,daviewingrange);
|
||||
cosang = mulscale14(cosang,daaspect);
|
||||
p = ylookup[windowy1]+frameplace+windowx2+1;
|
||||
for(y=windowy1;y<=windowy2;y++)
|
||||
{
|
||||
i = divscale16(tsizyup15,dx);
|
||||
stretchhline(0,(xdim>>1)*i+tsizyup15,xdim>>2,i,mulscale32(i,dy)*tsizy+bufplc,p);
|
||||
dx -= sinang; dy += cosang; p += ylookup[1];
|
||||
}
|
||||
walock[4094] = 1;
|
||||
|
||||
Bsprintf(tempbuf,"%d",(hang*180)>>10);
|
||||
printext256(0L,8L,31,-1,tempbuf,1);
|
||||
enddrawing();
|
||||
}
|
||||
#endif
|
||||
if (keystatus[0xa]) setaspect(viewingrange+(viewingrange>>8),yxaspect+(yxaspect>>8));
|
||||
if (keystatus[0xb]) setaspect(viewingrange-(viewingrange>>8),yxaspect-(yxaspect>>8));
|
||||
if (keystatus[0xc]) setaspect(viewingrange,yxaspect-(yxaspect>>8));
|
||||
if (keystatus[0xd]) setaspect(viewingrange,yxaspect+(yxaspect>>8));
|
||||
//if (keystatus[0x38]) setrollangle(rollangle+=((keystatus[0x2a]|keystatus[0x36])*6+2));
|
||||
//if (keystatus[0xb8]) setrollangle(rollangle-=((keystatus[0x2a]|keystatus[0x36])*6+2));
|
||||
//if (keystatus[0x1d]|keystatus[0x9d]) setrollangle(rollangle=0);
|
||||
|
||||
begindrawing();
|
||||
|
||||
i = frameval[framecnt&(AVERAGEFRAMES-1)];
|
||||
j = frameval[framecnt&(AVERAGEFRAMES-1)] = getticks(); framecnt++;
|
||||
if (i != j) averagefps = ((mul3(averagefps)+((AVERAGEFRAMES*1000)/(j-i)) )>>2);
|
||||
Bsprintf(tempbuf,"%ld",averagefps);
|
||||
printext256(0L,0L,31,-1,tempbuf,1);
|
||||
|
||||
enddrawing();
|
||||
editinput();
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void ExtCleanUp(void)
|
||||
{
|
||||
}
|
||||
|
||||
void ExtPreLoadMap(void)
|
||||
{
|
||||
}
|
||||
|
||||
void ExtLoadMap(const char *mapname)
|
||||
{
|
||||
char title[256];
|
||||
Bsprintf(title, "BUILD by Ken Silverman - %s", mapname);
|
||||
wm_setapptitle(title);
|
||||
}
|
||||
|
||||
void ExtPreSaveMap(void)
|
||||
{
|
||||
}
|
||||
|
||||
void ExtSaveMap(const char *mapname)
|
||||
{
|
||||
}
|
||||
|
||||
const char *ExtGetSectorCaption(short sectnum)
|
||||
{
|
||||
if ((sector[sectnum].lotag|sector[sectnum].hitag) == 0)
|
||||
{
|
||||
tempbuf[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Bsprintf(tempbuf,"%hu,%hu",(unsigned short)sector[sectnum].hitag,
|
||||
(unsigned short)sector[sectnum].lotag);
|
||||
}
|
||||
return(tempbuf);
|
||||
}
|
||||
|
||||
const char *ExtGetWallCaption(short wallnum)
|
||||
{
|
||||
if ((wall[wallnum].lotag|wall[wallnum].hitag) == 0)
|
||||
{
|
||||
tempbuf[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Bsprintf(tempbuf,"%hu,%hu",(unsigned short)wall[wallnum].hitag,
|
||||
(unsigned short)wall[wallnum].lotag);
|
||||
}
|
||||
return(tempbuf);
|
||||
}
|
||||
|
||||
const char *ExtGetSpriteCaption(short spritenum)
|
||||
{
|
||||
if ((sprite[spritenum].lotag|sprite[spritenum].hitag) == 0)
|
||||
{
|
||||
tempbuf[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Bsprintf(tempbuf,"%hu,%hu",(unsigned short)sprite[spritenum].hitag,
|
||||
(unsigned short)sprite[spritenum].lotag);
|
||||
}
|
||||
return(tempbuf);
|
||||
}
|
||||
|
||||
//printext16 parameters:
|
||||
//printext16(long xpos, long ypos, short col, short backcol,
|
||||
// char name[82], char fontsize)
|
||||
// xpos 0-639 (top left)
|
||||
// ypos 0-479 (top left)
|
||||
// col 0-15
|
||||
// backcol 0-15, -1 is transparent background
|
||||
// name
|
||||
// fontsize 0=8*8, 1=3*5
|
||||
|
||||
//drawline16 parameters:
|
||||
// drawline16(long x1, long y1, long x2, long y2, char col)
|
||||
// x1, x2 0-639
|
||||
// y1, y2 0-143 (status bar is 144 high, origin is top-left of STATUS BAR)
|
||||
// col 0-15
|
||||
|
||||
void ExtShowSectorData(short sectnum) //F5
|
||||
{
|
||||
int i;
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
begindrawing();
|
||||
clearmidstatbar16(); //Clear middle of status bar
|
||||
|
||||
Bsprintf(tempbuf,"Sector %d",sectnum);
|
||||
printext16(8,ydim16+32,11,-1,tempbuf,0);
|
||||
|
||||
printext16(8,ydim16+48,11,-1,"8*8 font: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789",0);
|
||||
printext16(8,ydim16+56,11,-1,"3*5 font: ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789",1);
|
||||
|
||||
i=ydim16; ydim16=ydim;
|
||||
drawline16(320,i+68,344,i+80,4); //Draw house
|
||||
drawline16(344,i+80,344,i+116,4);
|
||||
drawline16(344,i+116,296,i+116,4);
|
||||
drawline16(296,i+116,296,i+80,4);
|
||||
drawline16(296,i+80,320,i+68,4);
|
||||
ydim16=i;
|
||||
enddrawing();
|
||||
}
|
||||
}
|
||||
|
||||
void ExtShowWallData(short wallnum) //F6
|
||||
{
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
begindrawing();
|
||||
clearmidstatbar16(); //Clear middle of status bar
|
||||
|
||||
Bsprintf(tempbuf,"Wall %d",wallnum);
|
||||
printext16(8,ydim16+32,11,-1,tempbuf,0);
|
||||
enddrawing();
|
||||
}
|
||||
}
|
||||
|
||||
void ExtShowSpriteData(short spritenum) //F6
|
||||
{
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
begindrawing();
|
||||
clearmidstatbar16(); //Clear middle of status bar
|
||||
|
||||
Bsprintf(tempbuf,"Sprite %d",spritenum);
|
||||
printext16(8,ydim16+32,11,-1,tempbuf,0);
|
||||
enddrawing();
|
||||
}
|
||||
}
|
||||
|
||||
void ExtEditSectorData(short sectnum) //F7
|
||||
{
|
||||
short nickdata;
|
||||
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
//Ceiling
|
||||
if (searchstat == 1)
|
||||
sector[searchsector].ceilingpicnum++; //Just a stupid example
|
||||
|
||||
//Floor
|
||||
if (searchstat == 2)
|
||||
sector[searchsector].floorshade++; //Just a stupid example
|
||||
}
|
||||
else //In 2D mode
|
||||
{
|
||||
Bsprintf(tempbuf,"Sector (%d) Nick's variable: ",sectnum);
|
||||
nickdata = 0;
|
||||
nickdata = getnumber16(tempbuf,nickdata,65536L,0);
|
||||
|
||||
printmessage16(""); //Clear message box (top right of status bar)
|
||||
ExtShowSectorData(sectnum);
|
||||
}
|
||||
}
|
||||
|
||||
void ExtEditWallData(short wallnum) //F8
|
||||
{
|
||||
short nickdata;
|
||||
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
Bsprintf(tempbuf,"Wall (%d) Nick's variable: ",wallnum);
|
||||
nickdata = 0;
|
||||
nickdata = getnumber16(tempbuf,nickdata,65536L,0);
|
||||
|
||||
printmessage16(""); //Clear message box (top right of status bar)
|
||||
ExtShowWallData(wallnum);
|
||||
}
|
||||
}
|
||||
|
||||
void ExtEditSpriteData(short spritenum) //F8
|
||||
{
|
||||
short nickdata;
|
||||
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
Bsprintf(tempbuf,"Sprite (%d) Nick's variable: ",spritenum);
|
||||
nickdata = 0;
|
||||
nickdata = getnumber16(tempbuf,nickdata,65536L,0);
|
||||
printmessage16("");
|
||||
|
||||
printmessage16(""); //Clear message box (top right of status bar)
|
||||
ExtShowSpriteData(spritenum);
|
||||
}
|
||||
}
|
||||
|
||||
void faketimerhandler(void)
|
||||
{
|
||||
sampletimer();
|
||||
}
|
||||
|
||||
//Just thought you might want my getnumber16 code
|
||||
/*
|
||||
getnumber16(char namestart[80], short num, long maxnumber)
|
||||
{
|
||||
char buffer[80];
|
||||
long j, k, n, danum, oldnum;
|
||||
|
||||
danum = (long)num;
|
||||
oldnum = danum;
|
||||
while ((keystatus[0x1c] != 2) && (keystatus[0x1] == 0)) //Enter, ESC
|
||||
{
|
||||
sprintf(&buffer,"%s%ld_ ",namestart,danum);
|
||||
printmessage16(buffer);
|
||||
|
||||
for(j=2;j<=11;j++) //Scan numbers 0-9
|
||||
if (keystatus[j] > 0)
|
||||
{
|
||||
keystatus[j] = 0;
|
||||
k = j-1;
|
||||
if (k == 10) k = 0;
|
||||
n = (danum*10)+k;
|
||||
if (n < maxnumber) danum = n;
|
||||
}
|
||||
if (keystatus[0xe] > 0) // backspace
|
||||
{
|
||||
danum /= 10;
|
||||
keystatus[0xe] = 0;
|
||||
}
|
||||
if (keystatus[0x1c] == 1) //L. enter
|
||||
{
|
||||
oldnum = danum;
|
||||
keystatus[0x1c] = 2;
|
||||
asksave = 1;
|
||||
}
|
||||
}
|
||||
keystatus[0x1c] = 0;
|
||||
keystatus[0x1] = 0;
|
||||
return((short)oldnum);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* vim:ts=4:
|
||||
*/
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -82,7 +82,7 @@ static double dxb1[MAXWALLSB], dxb2[MAXWALLSB];
|
|||
#define USEZBUFFER 1 //1:use zbuffer (slow, nice sprite rendering), 0:no zbuffer (fast, bad sprite rendering)
|
||||
#define LINTERPSIZ 4 //log2 of interpolation size. 4:pretty fast&acceptable quality, 0:best quality/slow!
|
||||
#define DEPTHDEBUG 0 //1:render distance instead of texture, for debugging only!, 0:default
|
||||
#define FOGSCALE 0.0000700
|
||||
#define FOGSCALE 0.0000768
|
||||
#define PI 3.14159265358979323
|
||||
|
||||
static double gyxscale, gxyaspect, gviewxrange, ghalfx, grhalfxdown10, grhalfxdown10x, ghoriz;
|
||||
|
@ -3020,7 +3020,7 @@ static void polymost_drawalls (long bunch)
|
|||
|
||||
if (((cy0 < ocy0) || (cy1 < ocy1)) && (!((sec->ceilingstat§or[nextsectnum].ceilingstat)&1)))
|
||||
{
|
||||
globalpicnum = wal->picnum; globalshade = (wal->shade+2); globalpal = (long)((unsigned char)wal->pal);
|
||||
globalpicnum = wal->picnum; globalshade = wal->shade; globalpal = (long)((unsigned char)wal->pal);
|
||||
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,wallnum+16384);
|
||||
|
||||
if (!(wal->cstat&4)) i = sector[nextsectnum].ceilingz; else i = sec->ceilingz;
|
||||
|
@ -3056,7 +3056,7 @@ static void polymost_drawalls (long bunch)
|
|||
gux += (float)(nwal->xpanning-wal->xpanning)*gdx;
|
||||
guy += (float)(nwal->xpanning-wal->xpanning)*gdy;
|
||||
}
|
||||
globalpicnum = nwal->picnum; globalshade = (nwal->shade+2); globalpal = (long)((unsigned char)nwal->pal);
|
||||
globalpicnum = nwal->picnum; globalshade = nwal->shade; globalpal = (long)((unsigned char)nwal->pal);
|
||||
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,wallnum+16384);
|
||||
|
||||
if (!(nwal->cstat&4)) i = sector[nextsectnum].floorz; else i = sec->ceilingz;
|
||||
|
@ -3087,7 +3087,7 @@ static void polymost_drawalls (long bunch)
|
|||
if ((nextsectnum < 0) || (wal->cstat&32)) //White/1-way wall
|
||||
{
|
||||
if (nextsectnum < 0) globalpicnum = wal->picnum; else globalpicnum = wal->overpicnum;
|
||||
globalshade = (wal->shade+2); globalpal = (long)((unsigned char)wal->pal);
|
||||
globalshade = wal->shade; globalpal = (long)((unsigned char)wal->pal);
|
||||
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,wallnum+16384);
|
||||
|
||||
if (nextsectnum >= 0) { if (!(wal->cstat&4)) i = nextsec->ceilingz; else i = sec->ceilingz; }
|
||||
|
@ -3289,7 +3289,7 @@ void polymost_drawrooms ()
|
|||
ghalfx = (double)halfxdimen; grhalfxdown10 = 1.0/(((double)ghalfx)*1024);
|
||||
ghoriz = (double)globalhoriz;
|
||||
|
||||
gvisibility = ((float)globalvisibility)*gxyaspect*FOGSCALE;
|
||||
gvisibility = ((float)globalvisibility)*FOGSCALE;
|
||||
|
||||
//global cos/sin height angle
|
||||
r = (double)((ydimen>>1)-ghoriz);
|
||||
|
@ -3483,7 +3483,7 @@ void polymost_drawmaskwall (long damaskwallcnt)
|
|||
|
||||
globalpicnum = wal->overpicnum; if ((unsigned long)globalpicnum >= MAXTILES) globalpicnum = 0;
|
||||
if (picanm[globalpicnum]&192) globalpicnum += animateoffs(globalpicnum,(short)thewall[z]+16384);
|
||||
globalshade = (long)(wal->shade+2);
|
||||
globalshade = (long)wal->shade;
|
||||
globalpal = (long)((unsigned char)wal->pal);
|
||||
globalorientation = (long)wal->cstat;
|
||||
|
||||
|
|
|
@ -1,545 +0,0 @@
|
|||
/* NOTE: Glade will generate code for a dialogue box which you should
|
||||
* then patch into this file whenever you make a change to the Glade
|
||||
* template.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixdata.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#ifndef LINKED_GTK
|
||||
# include "dynamicgtk.h"
|
||||
#endif
|
||||
|
||||
#include "baselayer.h"
|
||||
#include "compat.h"
|
||||
#include "build.h"
|
||||
|
||||
#define TAB_CONFIG 0
|
||||
#define TAB_MESSAGES 1
|
||||
|
||||
static struct {
|
||||
int fullscreen;
|
||||
int xdim3d, ydim3d, bpp3d;
|
||||
int forcesetup;
|
||||
} settings;
|
||||
|
||||
extern int gtkenabled;
|
||||
|
||||
static GtkWidget *startwin = NULL;
|
||||
static int retval = -1, mode = TAB_MESSAGES;
|
||||
|
||||
// -- SUPPORT FUNCTIONS -------------------------------------------------------
|
||||
|
||||
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
|
||||
g_object_set_data_full (G_OBJECT (component), name, \
|
||||
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
|
||||
|
||||
#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
|
||||
g_object_set_data (G_OBJECT (component), name, widget)
|
||||
|
||||
#define lookup_widget(x,w) \
|
||||
(GtkWidget*) g_object_get_data(G_OBJECT(x), w)
|
||||
|
||||
static GdkPixbuf *load_banner(void)
|
||||
{
|
||||
extern const GdkPixdata startbanner_pixdata;
|
||||
return gdk_pixbuf_from_pixdata(&startbanner_pixdata, FALSE, NULL);
|
||||
}
|
||||
|
||||
static void SetPage(int n)
|
||||
{
|
||||
if (!gtkenabled || !startwin) return;
|
||||
mode = n;
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(startwin,"tabs")), n);
|
||||
|
||||
// each control in the config page vertical layout plus the start button should be made (in)sensitive
|
||||
if (n == TAB_CONFIG) n = TRUE; else n = FALSE;
|
||||
gtk_widget_set_sensitive(lookup_widget(startwin,"startbutton"), n);
|
||||
gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"configvlayout")),
|
||||
(GtkCallback)gtk_widget_set_sensitive, (gpointer)n);
|
||||
}
|
||||
|
||||
static void on_vmode3dcombo_changed(GtkComboBox *, gpointer);
|
||||
static void PopulateForm(void)
|
||||
{
|
||||
int mode3d, i;
|
||||
GtkListStore *modes3d;
|
||||
GtkTreeIter iter;
|
||||
GtkComboBox *box3d;
|
||||
char buf[64];
|
||||
|
||||
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1);
|
||||
if (mode3d < 0) {
|
||||
int i, cd[] = { 32, 24, 16, 15, 8, 0 };
|
||||
for (i=0; cd[i]; ) { if (cd[i] >= settings.bpp3d) i++; else break; }
|
||||
for ( ; cd[i]; i++) {
|
||||
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1);
|
||||
if (mode3d < 0) continue;
|
||||
settings.bpp3d = cd[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"fullscreencheck")), settings.fullscreen);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"alwaysshowcheck")), settings.forcesetup);
|
||||
|
||||
box3d = GTK_COMBO_BOX(lookup_widget(startwin,"vmode3dcombo"));
|
||||
modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(box3d));
|
||||
gtk_list_store_clear(modes3d);
|
||||
|
||||
for (i=0; i<validmodecnt; i++) {
|
||||
if (validmode[i].fs != settings.fullscreen) continue;
|
||||
|
||||
// all modes get added to the 3D mode list
|
||||
Bsprintf(buf, "%ld x %ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
|
||||
gtk_list_store_append(modes3d, &iter);
|
||||
gtk_list_store_set(modes3d, &iter, 0,buf, 1,i, -1);
|
||||
if (i == mode3d) {
|
||||
g_signal_handlers_block_by_func(box3d, on_vmode3dcombo_changed, NULL);
|
||||
gtk_combo_box_set_active_iter(box3d, &iter);
|
||||
g_signal_handlers_unblock_by_func(box3d, on_vmode3dcombo_changed, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -- EVENT CALLBACKS AND CREATION STUFF --------------------------------------
|
||||
|
||||
static void on_vmode3dcombo_changed(GtkComboBox *combobox, gpointer user_data)
|
||||
{
|
||||
GtkTreeModel *data;
|
||||
GtkTreeIter iter;
|
||||
int val;
|
||||
if (!gtk_combo_box_get_active_iter(combobox, &iter)) return;
|
||||
if (!(data = gtk_combo_box_get_model(combobox))) return;
|
||||
gtk_tree_model_get(data, &iter, 1, &val, -1);
|
||||
settings.xdim3d = validmode[val].xdim;
|
||||
settings.ydim3d = validmode[val].ydim;
|
||||
}
|
||||
|
||||
static void on_fullscreencheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
||||
{
|
||||
settings.fullscreen = (gtk_toggle_button_get_active(togglebutton) == TRUE);
|
||||
PopulateForm();
|
||||
}
|
||||
|
||||
static void on_alwaysshowcheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
|
||||
{
|
||||
settings.forcesetup = (gtk_toggle_button_get_active(togglebutton) == TRUE);
|
||||
}
|
||||
|
||||
static void on_cancelbutton_clicked(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
|
||||
else quitevent++;
|
||||
}
|
||||
|
||||
static void on_startbutton_clicked(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
retval = 1;
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
static gboolean on_startwin_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data)
|
||||
{
|
||||
if (mode == TAB_CONFIG) { retval = 0; gtk_main_quit(); }
|
||||
else quitevent++;
|
||||
return TRUE; // FALSE would let the event go through. we want the game to decide when to close
|
||||
}
|
||||
|
||||
|
||||
static GtkWidget *create_window(void)
|
||||
{
|
||||
GtkWidget *startwin;
|
||||
GtkWidget *hlayout;
|
||||
GtkWidget *banner;
|
||||
GtkWidget *vlayout;
|
||||
GtkWidget *tabs;
|
||||
GtkWidget *configvlayout;
|
||||
GtkWidget *configlayout;
|
||||
GtkWidget *vmode3dlabel;
|
||||
GtkWidget *vmode3dcombo;
|
||||
GtkWidget *fullscreencheck;
|
||||
GtkWidget *alwaysshowcheck;
|
||||
GtkWidget *configtab;
|
||||
GtkWidget *messagesscroll;
|
||||
GtkWidget *messagestext;
|
||||
GtkWidget *messagestab;
|
||||
GtkWidget *buttons;
|
||||
GtkWidget *cancelbutton;
|
||||
GtkWidget *cancelbuttonalign;
|
||||
GtkWidget *cancelbuttonlayout;
|
||||
GtkWidget *cancelbuttonicon;
|
||||
GtkWidget *cancelbuttonlabel;
|
||||
GtkWidget *startbutton;
|
||||
GtkWidget *startbuttonalign;
|
||||
GtkWidget *startbuttonlayout;
|
||||
GtkWidget *startbuttonicon;
|
||||
GtkWidget *startbuttonlabel;
|
||||
GtkAccelGroup *accel_group;
|
||||
|
||||
accel_group = gtk_accel_group_new ();
|
||||
|
||||
// Basic window
|
||||
startwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (startwin), apptitle); // NOTE: use global app title
|
||||
gtk_window_set_position (GTK_WINDOW (startwin), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_resizable (GTK_WINDOW (startwin), FALSE);
|
||||
gtk_window_set_type_hint (GTK_WINDOW (startwin), GDK_WINDOW_TYPE_HINT_DIALOG);
|
||||
|
||||
// Horizontal layout of banner and controls
|
||||
hlayout = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_show (hlayout);
|
||||
gtk_container_add (GTK_CONTAINER (startwin), hlayout);
|
||||
|
||||
// Banner
|
||||
{
|
||||
GdkPixbuf *pixbuf = load_banner();
|
||||
banner = gtk_image_new_from_pixbuf(pixbuf);
|
||||
g_object_unref((gpointer)pixbuf);
|
||||
}
|
||||
gtk_widget_show (banner);
|
||||
gtk_box_pack_start (GTK_BOX (hlayout), banner, FALSE, FALSE, 0);
|
||||
gtk_misc_set_alignment (GTK_MISC (banner), 0.5, 0);
|
||||
|
||||
// Vertical layout of tab control and start+cancel buttons
|
||||
vlayout = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (vlayout);
|
||||
gtk_box_pack_start (GTK_BOX (hlayout), vlayout, TRUE, TRUE, 0);
|
||||
|
||||
// Tab control
|
||||
tabs = gtk_notebook_new ();
|
||||
gtk_widget_show (tabs);
|
||||
gtk_box_pack_start (GTK_BOX (vlayout), tabs, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (tabs), 4);
|
||||
|
||||
// Vertical layout of config page main body
|
||||
configvlayout = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (configvlayout);
|
||||
gtk_container_add (GTK_CONTAINER (tabs), configvlayout);
|
||||
|
||||
// Fixed-position layout of config page controls
|
||||
configlayout = gtk_fixed_new ();
|
||||
gtk_widget_show (configlayout);
|
||||
gtk_box_pack_start (GTK_BOX (configvlayout), configlayout, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (configlayout), 6);
|
||||
|
||||
// 3D video mode label
|
||||
vmode3dlabel = gtk_label_new_with_mnemonic ("_Video mode:");
|
||||
gtk_widget_show (vmode3dlabel);
|
||||
gtk_fixed_put (GTK_FIXED (configlayout), vmode3dlabel, 0, 0);
|
||||
gtk_widget_set_size_request (vmode3dlabel, 88, 29);
|
||||
gtk_misc_set_alignment (GTK_MISC (vmode3dlabel), 0, 0.5);
|
||||
|
||||
// 3D video mode combo
|
||||
{
|
||||
GtkListStore *list = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
|
||||
GtkCellRenderer *cell;
|
||||
|
||||
vmode3dcombo = gtk_combo_box_new_with_model (GTK_TREE_MODEL(list));
|
||||
g_object_unref(G_OBJECT(list));
|
||||
|
||||
cell = gtk_cell_renderer_text_new();
|
||||
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(vmode3dcombo), cell, FALSE);
|
||||
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(vmode3dcombo), cell, "text", 0, NULL);
|
||||
}
|
||||
gtk_widget_show (vmode3dcombo);
|
||||
gtk_fixed_put (GTK_FIXED (configlayout), vmode3dcombo, 88, 0);
|
||||
gtk_widget_set_size_request (vmode3dcombo, 150, 29);
|
||||
gtk_widget_add_accelerator (vmode3dcombo, "grab_focus", accel_group,
|
||||
GDK_V, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
// Fullscreen checkbox
|
||||
fullscreencheck = gtk_check_button_new_with_mnemonic ("_Fullscreen");
|
||||
gtk_widget_show (fullscreencheck);
|
||||
gtk_fixed_put (GTK_FIXED (configlayout), fullscreencheck, 248, 0);
|
||||
gtk_widget_set_size_request (fullscreencheck, 85, 29);
|
||||
gtk_widget_add_accelerator (fullscreencheck, "grab_focus", accel_group,
|
||||
GDK_F, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
// Always show config checkbox
|
||||
alwaysshowcheck = gtk_check_button_new_with_mnemonic ("_Always show configuration on start");
|
||||
gtk_widget_show (alwaysshowcheck);
|
||||
gtk_box_pack_start (GTK_BOX (configvlayout), alwaysshowcheck, FALSE, FALSE, 0);
|
||||
gtk_widget_add_accelerator (alwaysshowcheck, "grab_focus", accel_group,
|
||||
GDK_A, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
// Configuration tab
|
||||
configtab = gtk_label_new ("Configuration");
|
||||
gtk_widget_show (configtab);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (tabs), gtk_notebook_get_nth_page (GTK_NOTEBOOK (tabs), 0), configtab);
|
||||
|
||||
// Messages scrollable area
|
||||
messagesscroll = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (messagesscroll);
|
||||
gtk_container_add (GTK_CONTAINER (tabs), messagesscroll);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (messagesscroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
||||
|
||||
// Messages text area
|
||||
messagestext = gtk_text_view_new ();
|
||||
gtk_widget_show (messagestext);
|
||||
gtk_container_add (GTK_CONTAINER (messagesscroll), messagestext);
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (messagestext), FALSE);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (messagestext), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (messagestext), FALSE);
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (messagestext), 2);
|
||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (messagestext), 2);
|
||||
|
||||
// Messages tab
|
||||
messagestab = gtk_label_new ("Messages");
|
||||
gtk_widget_show (messagestab);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (tabs), gtk_notebook_get_nth_page (GTK_NOTEBOOK (tabs), 1), messagestab);
|
||||
|
||||
// Dialogue box buttons layout
|
||||
buttons = gtk_hbutton_box_new ();
|
||||
gtk_widget_show (buttons);
|
||||
gtk_box_pack_start (GTK_BOX (vlayout), buttons, FALSE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (buttons), 3);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (buttons), GTK_BUTTONBOX_END);
|
||||
|
||||
// Cancel button
|
||||
cancelbutton = gtk_button_new ();
|
||||
gtk_widget_show (cancelbutton);
|
||||
gtk_container_add (GTK_CONTAINER (buttons), cancelbutton);
|
||||
GTK_WIDGET_SET_FLAGS (cancelbutton, GTK_CAN_DEFAULT);
|
||||
gtk_widget_add_accelerator (cancelbutton, "grab_focus", accel_group,
|
||||
GDK_C, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_widget_add_accelerator (cancelbutton, "clicked", accel_group,
|
||||
GDK_Escape, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
cancelbuttonalign = gtk_alignment_new (0.5, 0.5, 0, 0);
|
||||
gtk_widget_show (cancelbuttonalign);
|
||||
gtk_container_add (GTK_CONTAINER (cancelbutton), cancelbuttonalign);
|
||||
|
||||
cancelbuttonlayout = gtk_hbox_new (FALSE, 2);
|
||||
gtk_widget_show (cancelbuttonlayout);
|
||||
gtk_container_add (GTK_CONTAINER (cancelbuttonalign), cancelbuttonlayout);
|
||||
|
||||
cancelbuttonicon = gtk_image_new_from_stock ("gtk-cancel", GTK_ICON_SIZE_BUTTON);
|
||||
gtk_widget_show (cancelbuttonicon);
|
||||
gtk_box_pack_start (GTK_BOX (cancelbuttonlayout), cancelbuttonicon, FALSE, FALSE, 0);
|
||||
|
||||
cancelbuttonlabel = gtk_label_new_with_mnemonic ("_Cancel");
|
||||
gtk_widget_show (cancelbuttonlabel);
|
||||
gtk_box_pack_start (GTK_BOX (cancelbuttonlayout), cancelbuttonlabel, FALSE, FALSE, 0);
|
||||
|
||||
// Start button
|
||||
startbutton = gtk_button_new ();
|
||||
gtk_widget_show (startbutton);
|
||||
gtk_container_add (GTK_CONTAINER (buttons), startbutton);
|
||||
GTK_WIDGET_SET_FLAGS (startbutton, GTK_CAN_DEFAULT);
|
||||
gtk_widget_add_accelerator (startbutton, "grab_focus", accel_group,
|
||||
GDK_S, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_widget_add_accelerator (startbutton, "clicked", accel_group,
|
||||
GDK_Return, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
startbuttonalign = gtk_alignment_new (0.5, 0.5, 0, 0);
|
||||
gtk_widget_show (startbuttonalign);
|
||||
gtk_container_add (GTK_CONTAINER (startbutton), startbuttonalign);
|
||||
|
||||
startbuttonlayout = gtk_hbox_new (FALSE, 2);
|
||||
gtk_widget_show (startbuttonlayout);
|
||||
gtk_container_add (GTK_CONTAINER (startbuttonalign), startbuttonlayout);
|
||||
|
||||
startbuttonicon = gtk_image_new_from_stock ("gtk-execute", GTK_ICON_SIZE_BUTTON);
|
||||
gtk_widget_show (startbuttonicon);
|
||||
gtk_box_pack_start (GTK_BOX (startbuttonlayout), startbuttonicon, FALSE, FALSE, 0);
|
||||
|
||||
startbuttonlabel = gtk_label_new_with_mnemonic ("_Start");
|
||||
gtk_widget_show (startbuttonlabel);
|
||||
gtk_box_pack_start (GTK_BOX (startbuttonlayout), startbuttonlabel, FALSE, FALSE, 0);
|
||||
|
||||
// Wire up the signals
|
||||
g_signal_connect ((gpointer) startwin, "delete_event",
|
||||
G_CALLBACK (on_startwin_delete_event),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) vmode3dcombo, "changed",
|
||||
G_CALLBACK (on_vmode3dcombo_changed),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) fullscreencheck, "toggled",
|
||||
G_CALLBACK (on_fullscreencheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) alwaysshowcheck, "toggled",
|
||||
G_CALLBACK (on_alwaysshowcheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) cancelbutton, "clicked",
|
||||
G_CALLBACK (on_cancelbutton_clicked),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) startbutton, "clicked",
|
||||
G_CALLBACK (on_startbutton_clicked),
|
||||
NULL);
|
||||
|
||||
// Associate labels with their controls
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (vmode3dlabel), vmode3dcombo);
|
||||
|
||||
/* Store pointers to all widgets, for use by lookup_widget(). */
|
||||
GLADE_HOOKUP_OBJECT_NO_REF (startwin, startwin, "startwin");
|
||||
GLADE_HOOKUP_OBJECT (startwin, hlayout, "hlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, banner, "banner");
|
||||
GLADE_HOOKUP_OBJECT (startwin, vlayout, "vlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, tabs, "tabs");
|
||||
GLADE_HOOKUP_OBJECT (startwin, configvlayout, "configvlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, configlayout, "configlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, vmode3dlabel, "vmode3dlabel");
|
||||
GLADE_HOOKUP_OBJECT (startwin, vmode3dcombo, "vmode3dcombo");
|
||||
GLADE_HOOKUP_OBJECT (startwin, fullscreencheck, "fullscreencheck");
|
||||
GLADE_HOOKUP_OBJECT (startwin, alwaysshowcheck, "alwaysshowcheck");
|
||||
GLADE_HOOKUP_OBJECT (startwin, configtab, "configtab");
|
||||
GLADE_HOOKUP_OBJECT (startwin, messagesscroll, "messagesscroll");
|
||||
GLADE_HOOKUP_OBJECT (startwin, messagestext, "messagestext");
|
||||
GLADE_HOOKUP_OBJECT (startwin, messagestab, "messagestab");
|
||||
GLADE_HOOKUP_OBJECT (startwin, buttons, "buttons");
|
||||
GLADE_HOOKUP_OBJECT (startwin, cancelbutton, "cancelbutton");
|
||||
GLADE_HOOKUP_OBJECT (startwin, cancelbuttonalign, "cancelbuttonalign");
|
||||
GLADE_HOOKUP_OBJECT (startwin, cancelbuttonlayout, "cancelbuttonlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, cancelbuttonicon, "cancelbuttonicon");
|
||||
GLADE_HOOKUP_OBJECT (startwin, cancelbuttonlabel, "cancelbuttonlabel");
|
||||
GLADE_HOOKUP_OBJECT (startwin, startbutton, "startbutton");
|
||||
GLADE_HOOKUP_OBJECT (startwin, startbuttonalign, "startbuttonalign");
|
||||
GLADE_HOOKUP_OBJECT (startwin, startbuttonlayout, "startbuttonlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, startbuttonicon, "startbuttonicon");
|
||||
GLADE_HOOKUP_OBJECT (startwin, startbuttonlabel, "startbuttonlabel");
|
||||
|
||||
gtk_window_add_accel_group (GTK_WINDOW (startwin), accel_group);
|
||||
|
||||
return startwin;
|
||||
}
|
||||
|
||||
// -- BUILD ENTRY POINTS ------------------------------------------------------
|
||||
|
||||
int startwin_open(void)
|
||||
{
|
||||
if (!gtkenabled) return 0;
|
||||
if (startwin) return 1;
|
||||
|
||||
startwin = create_window();
|
||||
if (startwin) {
|
||||
SetPage(TAB_MESSAGES);
|
||||
gtk_widget_show(startwin);
|
||||
gtk_main_iteration_do(FALSE);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int startwin_close(void)
|
||||
{
|
||||
if (!gtkenabled) return 0;
|
||||
if (!startwin) return 1;
|
||||
gtk_widget_destroy (startwin);
|
||||
startwin = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_puts(const char *str)
|
||||
{
|
||||
GtkWidget *textview;
|
||||
GtkTextBuffer *textbuffer;
|
||||
GtkTextIter enditer;
|
||||
GtkTextMark *mark;
|
||||
const char *aptr, *bptr;
|
||||
|
||||
if (!gtkenabled || !str) return 0;
|
||||
if (!startwin) return 1;
|
||||
if (!(textview = lookup_widget(startwin, "messagestext"))) return -1;
|
||||
textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
|
||||
|
||||
gtk_text_buffer_get_end_iter(textbuffer, &enditer);
|
||||
for (aptr = bptr = str; *aptr != 0; ) {
|
||||
switch (*bptr) {
|
||||
case '\b':
|
||||
if (bptr > aptr)
|
||||
gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1);
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE);
|
||||
#else
|
||||
{
|
||||
GtkTextIter iter2 = enditer;
|
||||
gtk_text_iter_backward_cursor_position(&iter2);
|
||||
//FIXME: this seems be deleting one too many chars somewhere!
|
||||
if (!gtk_text_iter_equal(&iter2, &enditer))
|
||||
gtk_text_buffer_delete_interactive(textbuffer, &iter2, &enditer, TRUE);
|
||||
}
|
||||
#endif
|
||||
aptr = ++bptr;
|
||||
break;
|
||||
case 0:
|
||||
if (bptr > aptr)
|
||||
gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr));
|
||||
aptr = bptr;
|
||||
break;
|
||||
case '\r': // FIXME
|
||||
default:
|
||||
bptr++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mark = gtk_text_buffer_create_mark(textbuffer, NULL, &enditer, 1);
|
||||
gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textview), mark, 0.0, FALSE, 0.0, 1.0);
|
||||
gtk_text_buffer_delete_mark(textbuffer, mark);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_settitle(const char *title)
|
||||
{
|
||||
if (!gtkenabled) return 0;
|
||||
if (!startwin) return 1;
|
||||
gtk_window_set_title (GTK_WINDOW (startwin), title);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_idle(void *s)
|
||||
{
|
||||
if (!gtkenabled) return 0;
|
||||
//if (!startwin) return 1;
|
||||
gtk_main_iteration_do (FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int xdimgame, ydimgame, bppgame, forcesetup;
|
||||
|
||||
int startwin_run(void)
|
||||
{
|
||||
if (!gtkenabled) return 0;
|
||||
if (!startwin) return 1;
|
||||
|
||||
SetPage(TAB_CONFIG);
|
||||
|
||||
settings.fullscreen = fullscreen;
|
||||
settings.xdim3d = xdimgame;
|
||||
settings.ydim3d = ydimgame;
|
||||
settings.bpp3d = bppgame;
|
||||
settings.forcesetup = forcesetup;
|
||||
PopulateForm();
|
||||
|
||||
gtk_main();
|
||||
|
||||
SetPage(TAB_MESSAGES);
|
||||
if (retval) {
|
||||
fullscreen = settings.fullscreen;
|
||||
xdimgame = settings.xdim3d;
|
||||
ydimgame = settings.ydim3d;
|
||||
bppgame = settings.bpp3d;
|
||||
forcesetup = settings.forcesetup;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
@ -1,422 +0,0 @@
|
|||
#ifndef RENDERTYPEWIN
|
||||
#error Only for Windows
|
||||
#endif
|
||||
|
||||
#include "build.h"
|
||||
#include "winlayer.h"
|
||||
#include "compat.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#define _WIN32_IE 0x0300
|
||||
#include <commctrl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "startwin.game.h"
|
||||
|
||||
#define TAB_CONFIG 0
|
||||
#define TAB_MESSAGES 1
|
||||
|
||||
static struct {
|
||||
int fullscreen;
|
||||
int xdim3d, ydim3d, bpp3d;
|
||||
int forcesetup;
|
||||
} settings;
|
||||
|
||||
static HWND startupdlg = NULL;
|
||||
static HWND pages[2] = { NULL, NULL};
|
||||
static int done = -1, mode = TAB_CONFIG;
|
||||
|
||||
static void PopulateForm(void)
|
||||
{
|
||||
int i,j;
|
||||
char buf[64];
|
||||
int mode3d;
|
||||
HWND hwnd3d;
|
||||
|
||||
hwnd3d = GetDlgItem(pages[TAB_CONFIG], IDC3DVMODE);
|
||||
|
||||
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1);
|
||||
if (mode3d < 0) {
|
||||
int cd[] = { 32, 24, 16, 15, 8, 0 };
|
||||
for (i=0; cd[i]; ) { if (cd[i] >= settings.bpp3d) i++; else break; }
|
||||
for ( ; cd[i]; i++) {
|
||||
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1);
|
||||
if (mode3d < 0) continue;
|
||||
settings.bpp3d = cd[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), (settings.fullscreen ? BST_CHECKED : BST_UNCHECKED));
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCALWAYSSHOW), (settings.forcesetup ? BST_CHECKED : BST_UNCHECKED));
|
||||
|
||||
ComboBox_ResetContent(hwnd3d);
|
||||
for (i=0; i<validmodecnt; i++) {
|
||||
if (validmode[i].fs != settings.fullscreen) continue;
|
||||
|
||||
// all modes get added to the 3D mode list
|
||||
Bsprintf(buf, "%ld x %ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
|
||||
j = ComboBox_AddString(hwnd3d, buf);
|
||||
ComboBox_SetItemData(hwnd3d, j, i);
|
||||
if (i == mode3d) ComboBox_SetCurSel(hwnd3d, j);
|
||||
}
|
||||
}
|
||||
|
||||
static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (uMsg) {
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDCFULLSCREEN:
|
||||
settings.fullscreen = !settings.fullscreen;
|
||||
PopulateForm();
|
||||
return TRUE;
|
||||
case IDC3DVMODE:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE) {
|
||||
int i;
|
||||
i = ComboBox_GetCurSel((HWND)lParam);
|
||||
if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
|
||||
if (i != CB_ERR) {
|
||||
settings.xdim3d = validmode[i].xdim;
|
||||
settings.ydim3d = validmode[i].ydim;
|
||||
settings.bpp3d = validmode[i].bpp;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
case IDCALWAYSSHOW:
|
||||
settings.forcesetup = IsDlgButtonChecked(hwndDlg, IDCALWAYSSHOW) == BST_CHECKED;
|
||||
return TRUE;
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void SetPage(int n)
|
||||
{
|
||||
HWND tab;
|
||||
int cur;
|
||||
tab = GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL);
|
||||
cur = (int)SendMessage(tab, TCM_GETCURSEL,0,0);
|
||||
ShowWindow(pages[cur],SW_HIDE);
|
||||
SendMessage(tab, TCM_SETCURSEL, n, 0);
|
||||
ShowWindow(pages[n],SW_SHOW);
|
||||
mode = n;
|
||||
|
||||
SetFocus(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL));
|
||||
}
|
||||
|
||||
static void EnableConfig(int n)
|
||||
{
|
||||
//EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_CANCEL), n);
|
||||
EnableWindow(GetDlgItem(startupdlg, WIN_STARTWIN_START), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDC3DVMODE), n);
|
||||
}
|
||||
|
||||
static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static HBITMAP hbmp = NULL;
|
||||
HDC hdc;
|
||||
|
||||
switch (uMsg) {
|
||||
case WM_INITDIALOG: {
|
||||
HWND hwnd;
|
||||
RECT r, rdlg, chrome, rtab, rcancel, rstart;
|
||||
int xoffset = 0, yoffset = 0;
|
||||
|
||||
// Fetch the positions (in screen coordinates) of all the windows we need to tweak
|
||||
ZeroMemory(&chrome, sizeof(chrome));
|
||||
AdjustWindowRect(&chrome, GetWindowLong(hwndDlg, GWL_STYLE), FALSE);
|
||||
GetWindowRect(hwndDlg, &rdlg);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), &rtab);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), &rcancel);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_START), &rstart);
|
||||
|
||||
// Knock off the non-client area of the main dialogue to give just the client area
|
||||
rdlg.left -= chrome.left; rdlg.top -= chrome.top;
|
||||
rdlg.right -= chrome.right; rdlg.bottom -= chrome.bottom;
|
||||
|
||||
// Translate them to client-relative coordinates wrt the main dialogue window
|
||||
rtab.right -= rtab.left - 1; rtab.bottom -= rtab.top - 1;
|
||||
rtab.left -= rdlg.left; rtab.top -= rdlg.top;
|
||||
|
||||
rcancel.right -= rcancel.left - 1; rcancel.bottom -= rcancel.top - 1;
|
||||
rcancel.left -= rdlg.left; rcancel.top -= rdlg.top;
|
||||
|
||||
rstart.right -= rstart.left - 1; rstart.bottom -= rstart.top - 1;
|
||||
rstart.left -= rdlg.left; rstart.top -= rdlg.top;
|
||||
|
||||
// And then convert the main dialogue coordinates to just width/length
|
||||
rdlg.right -= rdlg.left - 1; rdlg.bottom -= rdlg.top - 1;
|
||||
rdlg.left = 0; rdlg.top = 0;
|
||||
|
||||
// Load the bitmap into the bitmap control and fetch its dimensions
|
||||
hbmp = LoadBitmap((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(RSRC_BMP));
|
||||
hwnd = GetDlgItem(hwndDlg,WIN_STARTWIN_BITMAP);
|
||||
SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp);
|
||||
GetClientRect(hwnd, &r);
|
||||
xoffset = r.right;
|
||||
yoffset = r.bottom - rdlg.bottom;
|
||||
|
||||
// Shift and resize the controls that require it
|
||||
rtab.left += xoffset; rtab.bottom += yoffset;
|
||||
rcancel.left += xoffset; rcancel.top += yoffset;
|
||||
rstart.left += xoffset; rstart.top += yoffset;
|
||||
rdlg.right += xoffset;
|
||||
rdlg.bottom += yoffset;
|
||||
|
||||
// Move the controls to their new positions
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), rtab.left, rtab.top, rtab.right, rtab.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), rcancel.left, rcancel.top, rcancel.right, rcancel.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_START), rstart.left, rstart.top, rstart.right, rstart.bottom, FALSE);
|
||||
|
||||
// Move the main dialogue to the centre of the screen
|
||||
hdc = GetDC(NULL);
|
||||
rdlg.left = (GetDeviceCaps(hdc, HORZRES) - rdlg.right) / 2;
|
||||
rdlg.top = (GetDeviceCaps(hdc, VERTRES) - rdlg.bottom) / 2;
|
||||
ReleaseDC(NULL, hdc);
|
||||
MoveWindow(hwndDlg, rdlg.left + chrome.left, rdlg.top + chrome.left,
|
||||
rdlg.right + (-chrome.left+chrome.right), rdlg.bottom + (-chrome.top+chrome.bottom), TRUE);
|
||||
|
||||
// Add tabs to the tab control
|
||||
{
|
||||
TCITEM tab;
|
||||
|
||||
hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL);
|
||||
|
||||
ZeroMemory(&tab, sizeof(tab));
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Configuration");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)0, (LPARAM)&tab);
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Messages");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)1, (LPARAM)&tab);
|
||||
|
||||
// Work out the position and size of the area inside the tab control for the pages
|
||||
ZeroMemory(&r, sizeof(r));
|
||||
GetClientRect(hwnd, &r);
|
||||
SendMessage(hwnd, TCM_ADJUSTRECT, FALSE, (LPARAM)&r);
|
||||
r.right -= r.left-1;
|
||||
r.bottom -= r.top-1;
|
||||
r.top += rtab.top;
|
||||
r.left += rtab.left;
|
||||
|
||||
// Create the pages and position them in the tab control, but hide them
|
||||
pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(),
|
||||
MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc);
|
||||
pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES);
|
||||
SetWindowPos(pages[TAB_CONFIG], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
SetWindowPos(pages[TAB_MESSAGES], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
|
||||
// Tell the editfield acting as the console to exclude the width of the scrollbar
|
||||
GetClientRect(pages[TAB_MESSAGES],&r);
|
||||
r.right -= GetSystemMetrics(SM_CXVSCROLL)+4;
|
||||
r.left = r.top = 0;
|
||||
SendMessage(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r);
|
||||
|
||||
SetFocus(GetDlgItem(hwndDlg, WIN_STARTWIN_START));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
case WM_NOTIFY: {
|
||||
LPNMHDR nmhdr = (LPNMHDR)lParam;
|
||||
int cur;
|
||||
if (nmhdr->idFrom != WIN_STARTWIN_TABCTL) break;
|
||||
cur = (int)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0);
|
||||
switch (nmhdr->code) {
|
||||
case TCN_SELCHANGING: {
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_HIDE);
|
||||
return TRUE;
|
||||
}
|
||||
case TCN_SELCHANGE: {
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_SHOW);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_CLOSE:
|
||||
if (mode == TAB_CONFIG) done = 0;
|
||||
else quitevent++;
|
||||
return TRUE;
|
||||
|
||||
case WM_DESTROY:
|
||||
if (hbmp) {
|
||||
DeleteObject(hbmp);
|
||||
hbmp = NULL;
|
||||
}
|
||||
|
||||
if (pages[TAB_CONFIG]) {
|
||||
DestroyWindow(pages[TAB_CONFIG]);
|
||||
pages[TAB_CONFIG] = NULL;
|
||||
}
|
||||
|
||||
startupdlg = NULL;
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case WIN_STARTWIN_CANCEL:
|
||||
if (mode == TAB_CONFIG) done = 0;
|
||||
else quitevent++;
|
||||
return TRUE;
|
||||
case WIN_STARTWIN_START: done = 1; return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
case WM_CTLCOLORSTATIC:
|
||||
if ((HWND)lParam == pages[TAB_MESSAGES])
|
||||
return (BOOL)GetSysColorBrush(COLOR_WINDOW);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
int startwin_open(void)
|
||||
{
|
||||
INITCOMMONCONTROLSEX icc;
|
||||
if (startupdlg) return 1;
|
||||
icc.dwSize = sizeof(icc);
|
||||
icc.dwICC = ICC_TAB_CLASSES;
|
||||
InitCommonControlsEx(&icc);
|
||||
startupdlg = CreateDialog((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(WIN_STARTWIN), NULL, startup_dlgproc);
|
||||
if (startupdlg) {
|
||||
SetPage(TAB_MESSAGES);
|
||||
EnableConfig(0);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int startwin_close(void)
|
||||
{
|
||||
if (!startupdlg) return 1;
|
||||
DestroyWindow(startupdlg);
|
||||
startupdlg = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_puts(const char *buf)
|
||||
{
|
||||
const char *p = NULL, *q = NULL;
|
||||
char workbuf[1024];
|
||||
static int newline = 0;
|
||||
int curlen, linesbefore, linesafter;
|
||||
HWND edctl;
|
||||
int vis;
|
||||
|
||||
if (!startupdlg) return 1;
|
||||
|
||||
edctl = pages[TAB_MESSAGES];
|
||||
if (!edctl) return -1;
|
||||
|
||||
vis = ((int)SendMessage(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL), TCM_GETCURSEL,0,0) == TAB_MESSAGES);
|
||||
|
||||
if (vis) SendMessage(edctl, WM_SETREDRAW, FALSE,0);
|
||||
curlen = SendMessage(edctl, WM_GETTEXTLENGTH, 0,0);
|
||||
SendMessage(edctl, EM_SETSEL, (WPARAM)curlen, (LPARAM)curlen);
|
||||
linesbefore = SendMessage(edctl, EM_GETLINECOUNT, 0,0);
|
||||
p = buf;
|
||||
while (*p) {
|
||||
if (newline) {
|
||||
SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)"\r\n");
|
||||
newline = 0;
|
||||
}
|
||||
q = p;
|
||||
while (*q && *q != '\n') q++;
|
||||
memcpy(workbuf, p, q-p);
|
||||
if (*q == '\n') {
|
||||
if (!q[1]) {
|
||||
newline = 1;
|
||||
workbuf[q-p] = 0;
|
||||
} else {
|
||||
workbuf[q-p] = '\r';
|
||||
workbuf[q-p+1] = '\n';
|
||||
workbuf[q-p+2] = 0;
|
||||
}
|
||||
p = q+1;
|
||||
} else {
|
||||
workbuf[q-p] = 0;
|
||||
p = q;
|
||||
}
|
||||
SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)workbuf);
|
||||
}
|
||||
linesafter = SendMessage(edctl, EM_GETLINECOUNT, 0,0);
|
||||
SendMessage(edctl, EM_LINESCROLL, 0, linesafter-linesbefore);
|
||||
if (vis) SendMessage(edctl, WM_SETREDRAW, TRUE,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_settitle(const char *str)
|
||||
{
|
||||
if (!startupdlg) return 1;
|
||||
SetWindowText(startupdlg, str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int startwin_idle(void *v)
|
||||
{
|
||||
if (!startupdlg || !IsWindow(startupdlg)) return 0;
|
||||
if (IsDialogMessage(startupdlg, (MSG*)v)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int xdimgame, ydimgame, bppgame, forcesetup;
|
||||
|
||||
int startwin_run(void)
|
||||
{
|
||||
MSG msg;
|
||||
if (!startupdlg) return 1;
|
||||
|
||||
done = -1;
|
||||
|
||||
SetPage(TAB_CONFIG);
|
||||
EnableConfig(1);
|
||||
|
||||
settings.fullscreen = fullscreen;
|
||||
settings.xdim3d = xdimgame;
|
||||
settings.ydim3d = ydimgame;
|
||||
settings.bpp3d = bppgame;
|
||||
settings.forcesetup = forcesetup;
|
||||
PopulateForm();
|
||||
|
||||
while (done < 0) {
|
||||
switch (GetMessage(&msg, NULL, 0,0)) {
|
||||
case 0: done = 1; break;
|
||||
case -1: return -1;
|
||||
default:
|
||||
if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) break;
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SetPage(TAB_MESSAGES);
|
||||
EnableConfig(0);
|
||||
if (done) {
|
||||
fullscreen = settings.fullscreen;
|
||||
xdimgame = settings.xdim3d;
|
||||
ydimgame = settings.ydim3d;
|
||||
bppgame = settings.bpp3d;
|
||||
forcesetup = settings.forcesetup;
|
||||
}
|
||||
|
||||
return done;
|
||||
}
|
||||
|
1
polymer/build/watcomhax/cerrno
Executable file
1
polymer/build/watcomhax/cerrno
Executable file
|
@ -0,0 +1 @@
|
|||
#include <errno.h>
|
2
polymer/build/watcomhax/cmath
Executable file
2
polymer/build/watcomhax/cmath
Executable file
|
@ -0,0 +1,2 @@
|
|||
#include <math.h>
|
||||
#define M_PI 3.14159265358979323846
|
1
polymer/build/watcomhax/cstdarg
Executable file
1
polymer/build/watcomhax/cstdarg
Executable file
|
@ -0,0 +1 @@
|
|||
#include <stdarg.h>
|
1
polymer/build/watcomhax/cstdio
Executable file
1
polymer/build/watcomhax/cstdio
Executable file
|
@ -0,0 +1 @@
|
|||
#include <stdio.h>
|
1
polymer/build/watcomhax/cstdlib
Executable file
1
polymer/build/watcomhax/cstdlib
Executable file
|
@ -0,0 +1 @@
|
|||
#include <stdlib.h>
|
1
polymer/build/watcomhax/cstring
Executable file
1
polymer/build/watcomhax/cstring
Executable file
|
@ -0,0 +1 @@
|
|||
#include <string.h>
|
1
polymer/build/watcomhax/ctime
Executable file
1
polymer/build/watcomhax/ctime
Executable file
|
@ -0,0 +1 @@
|
|||
#include <time.h>
|
|
@ -30,11 +30,11 @@ CC=cl
|
|||
AS=ml
|
||||
LINK=link /opt:nowin98 /nologo /opt:ref
|
||||
CFLAGS= /MD /J /nologo $(flags_cl) \
|
||||
/I$(INC) /I$(EINC) /I$(SRC)jmact /I$(SRC)jaudiolib /I..\jfaud\src \
|
||||
/I$(INC) /I$(EINC) /I$(SRC)jmact /I$(SRC)jaudiolib /I..\jfaud\inc \
|
||||
/DNOCOPYPROTECT $(ENGINEOPTS) \
|
||||
/I$(DXROOT)\include /DRENDERTYPEWIN=1
|
||||
LIBS=user32.lib gdi32.lib shell32.lib dxguid.lib winmm.lib wsock32.lib \
|
||||
..\jfaud\jfaud.lib ..\jfaud\mpadec\mpadec.lib /NODEFAULTLIB:libFLAC.lib \
|
||||
LIBS=user32.lib gdi32.lib shell32.lib dxguid.lib winmm.lib wsock32.lib comctl32.lib \
|
||||
..\jfaud\jfaud.lib /NODEFAULTLIB:libFLAC.lib \
|
||||
#opengl32.lib
|
||||
ASFLAGS=/nologo /coff
|
||||
ASFLAGS=/nologo /coff
|
||||
|
@ -86,7 +86,7 @@ AUDIOLIBOBJ=$(AUDIOLIB_JFAUD)
|
|||
$(OBJ)osdcmds.$o \
|
||||
$(JMACTOBJ) \
|
||||
$(AUDIOLIBOBJ) \
|
||||
$(OBJ)winbits.$o $(OBJ)gameres.res
|
||||
$(OBJ)winbits.$o $(OBJ)gameres.res $(OBJ)startwin.game.$o
|
||||
|
||||
EDITOROBJS=$(OBJ)astub.$o \
|
||||
$(OBJ)buildres.res
|
||||
|
@ -117,7 +117,7 @@ EDITOROBJS=$(OBJ)astub.$o \
|
|||
$(CC) /c $(CFLAGS) /Fo$@ $<
|
||||
|
||||
{$(SRC)misc}.rc{$(OBJ)}.res:
|
||||
$(RC) /fo$@ /r $<
|
||||
$(RC) /i$(EINC) /i$(SRC) /fo$@ /r $<
|
||||
|
||||
|
||||
# TARGETS
|
||||
|
|
|
@ -20,10 +20,11 @@ DXROOT=c:\sdks\msc\dx7
|
|||
ENGINEOPTS=-dSUPERBUILD -dPOLYMOST -dUSE_OPENGL
|
||||
|
||||
CC=wcc386
|
||||
CFLAGS= -5r -s -orb -fp5 -d2 -db &
|
||||
-i=$(INC) -i=$(EINC) -i=$(SRC)jmact -i=$(SRC)jaudiolib -i=$(DXROOT)\include &
|
||||
-dRENDERTYPEWIN=1 -dNOCOPYPROTECT $(ENGINEOPTS)
|
||||
LIBS=winmm.lib wsock32.lib dxguid.lib #opengl32.lib
|
||||
CXX=wpp386
|
||||
CFLAGS= -zq -5r -s -orb -fp5 -d2 -db &
|
||||
-i=watcomhax -i=$(INC) -i=$(EINC) -i=$(SRC)jmact -i=$(SRC)jaudiolib -i=$(DXROOT)\include &
|
||||
-dRENDERTYPEWIN=1 -dNOCOPYPROTECT $(ENGINEOPTS) -i=..\jfaud\inc
|
||||
LIBS=wsock32.lib dxguid.lib ..\jfaud\jfaud.lib winmm.lib #opengl32.lib
|
||||
WASMFLAGS=-d1
|
||||
EXESUFFIX=.exe
|
||||
|
||||
|
@ -35,9 +36,9 @@ JMACTOBJ=$(OBJ)util_lib.$o &
|
|||
$(OBJ)mathutil.$o &
|
||||
$(OBJ)scriplib.$o
|
||||
|
||||
#JAUDIOLIB_FX=$(OBJ)jaudiolib_fxstub.$o
|
||||
#JAUDIOLIB_MUSIC=$(OBJ)jaudiolib_musicstub.$o
|
||||
#JAUDIOLIB_FX=$(OBJ)jaudiolib_fx_fmod.$o
|
||||
JAUDIOLIB_FX_STUB=$(OBJ)jaudiolib_fxstub.$o
|
||||
JAUDIOLIB_MUSIC_STUB=$(OBJ)jaudiolib_musicstub.$o
|
||||
JAUDIOLIB_JFAUD=$(OBJ)jfaud_sounds.$o
|
||||
JAUDIOLIB_FX=$(OBJ)mv_mix.$o &
|
||||
$(OBJ)mv_mix16.$o &
|
||||
$(OBJ)mvreverb.$o &
|
||||
|
@ -49,7 +50,9 @@ JAUDIOLIB_FX=$(OBJ)mv_mix.$o &
|
|||
JAUDIOLIB_MUSIC=$(OBJ)midi.$o &
|
||||
$(OBJ)mpu401.$o &
|
||||
$(OBJ)music.$o
|
||||
JAUDIOLIBOBJ=$(JAUDIOLIB_MUSIC) $(JAUDIOLIB_FX)
|
||||
#JAUDIOLIBOBJ=$(JAUDIOLIB_MUSIC) $(JAUDIOLIB_FX) $(OBJ)sounds.$o
|
||||
#JAUDIOLIBOBJ=$(JAUDIOLIB_MUSIC_STUB) $(JAUDIOLIB_FX_STUB) $(OBJ)sounds.$o
|
||||
JAUDIOLIBOBJ=$(JAUDIOLIB_JFAUD)
|
||||
|
||||
GAMEOBJS=$(OBJ)game.$o &
|
||||
$(OBJ)actors.$o &
|
||||
|
@ -63,7 +66,6 @@ GAMEOBJS=$(OBJ)game.$o &
|
|||
$(OBJ)premap.$o &
|
||||
$(OBJ)savegame.$o &
|
||||
$(OBJ)sector.$o &
|
||||
$(OBJ)sounds.$o &
|
||||
$(OBJ)rts.$o &
|
||||
$(OBJ)config.$o &
|
||||
$(OBJ)animlib.$o &
|
||||
|
@ -71,6 +73,7 @@ GAMEOBJS=$(OBJ)game.$o &
|
|||
$(OBJ)osdfuncs.$o &
|
||||
$(OBJ)osdcmds.$o &
|
||||
$(OBJ)winbits.$o &
|
||||
$(OBJ)startwin.game.$o &
|
||||
$(JMACTOBJ) &
|
||||
$(JAUDIOLIBOBJ)
|
||||
|
||||
|
@ -82,6 +85,7 @@ EDITOROBJS=$(OBJ)astub.$o
|
|||
.wasm: $(SRC)
|
||||
.wasm: $(SRC)jaudiolib/
|
||||
.c: $(SRC)
|
||||
.cpp: $(SRC)
|
||||
.c: $(SRC)jmact/
|
||||
.c: $(SRC)jaudiolib/
|
||||
.c: $(SRC)util/
|
||||
|
@ -92,9 +96,11 @@ EDITOROBJS=$(OBJ)astub.$o
|
|||
|
||||
.c.$o:
|
||||
$(CC) $(CFLAGS) -fo=$(OBJ).$o $[@
|
||||
.cpp.$o:
|
||||
$(CXX) $(CFLAGS) -fo=$(OBJ).$o $[@
|
||||
|
||||
.rc.res:
|
||||
wrc -fo=$^*.res -r $[@
|
||||
wrc -i=$(EINC) -i=$(SRC) -fo=$^*.res -r $[@
|
||||
|
||||
|
||||
# TARGETS
|
||||
|
|
File diff suppressed because it is too large
Load diff
1
polymer/eduke32/watcomhax/cerrno
Executable file
1
polymer/eduke32/watcomhax/cerrno
Executable file
|
@ -0,0 +1 @@
|
|||
#include <errno.h>
|
2
polymer/eduke32/watcomhax/cmath
Executable file
2
polymer/eduke32/watcomhax/cmath
Executable file
|
@ -0,0 +1,2 @@
|
|||
#include <math.h>
|
||||
#define M_PI 3.14159265358979323846
|
1
polymer/eduke32/watcomhax/cstdarg
Executable file
1
polymer/eduke32/watcomhax/cstdarg
Executable file
|
@ -0,0 +1 @@
|
|||
#include <stdarg.h>
|
1
polymer/eduke32/watcomhax/cstdio
Executable file
1
polymer/eduke32/watcomhax/cstdio
Executable file
|
@ -0,0 +1 @@
|
|||
#include <stdio.h>
|
1
polymer/eduke32/watcomhax/cstdlib
Executable file
1
polymer/eduke32/watcomhax/cstdlib
Executable file
|
@ -0,0 +1 @@
|
|||
#include <stdlib.h>
|
1
polymer/eduke32/watcomhax/cstring
Executable file
1
polymer/eduke32/watcomhax/cstring
Executable file
|
@ -0,0 +1 @@
|
|||
#include <string.h>
|
1
polymer/eduke32/watcomhax/ctime
Executable file
1
polymer/eduke32/watcomhax/ctime
Executable file
|
@ -0,0 +1 @@
|
|||
#include <time.h>
|
Loading…
Reference in a new issue