Rip out the Build test game

git-svn-id: https://svn.eduke32.com/eduke32@336 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-11-16 03:00:03 +00:00
parent 628ef41cc4
commit 9f9ccf8344
14 changed files with 14 additions and 8634 deletions

View file

@ -33,7 +33,6 @@ FMODROOTWIN=c:/sdks/fmodapi374win/api
# build locations - OBJ gets overridden to the game-specific objects dir # build locations - OBJ gets overridden to the game-specific objects dir
OBJ?=obj.gnu OBJ?=obj.gnu
SRC=src SRC=src
GAME=testgame
RSRC=rsrc RSRC=rsrc
INC=include INC=include
@ -61,9 +60,7 @@ OURCFLAGS=$(debug) -W -Wall -Wimplicit -Wno-char-subscripts -Wno-unused \
-funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS \ -funsigned-char -fno-strict-aliasing -DNO_GCC_BUILTINS \
-DKSFORBUILD -I$(INC) -DKSFORBUILD -I$(INC)
OURCXXFLAGS=-fno-exceptions -fno-rtti OURCXXFLAGS=-fno-exceptions -fno-rtti
GAMECFLAGS=-I../jfaud/inc -I$(GAME)/
LIBS= LIBS=
GAMELIBS=../jfaud/libjfaud.a #../jfaud/mpadec/libmpadec/libmpadec.a
ASFLAGS=-s #-g ASFLAGS=-s #-g
EXESUFFIX= EXESUFFIX=
@ -96,15 +93,6 @@ ENGINEOBJS+= \
EDITOROBJS=$(OBJ)/build.$o \ EDITOROBJS=$(OBJ)/build.$o \
$(OBJ)/config.$o $(OBJ)/config.$o
GAMEEXEOBJS=$(OBJ)/game.$o \
$(OBJ)/jfaud_sound.$o \
$(OBJ)/config.$o \
$(OBJ)/$(ENGINELIB)
EDITOREXEOBJS=$(OBJ)/bstub.$o \
$(OBJ)/$(EDITORLIB) \
$(OBJ)/$(ENGINELIB)
# detect the platform # detect the platform
ifeq ($(PLATFORM),LINUX) ifeq ($(PLATFORM),LINUX)
ASFLAGS+= -f elf ASFLAGS+= -f elf
@ -118,7 +106,6 @@ endif
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
OURCFLAGS+= -DUNDERSCORES -I$(DXROOT)/include -I$(FMODROOTWIN)/inc OURCFLAGS+= -DUNDERSCORES -I$(DXROOT)/include -I$(FMODROOTWIN)/inc
LIBS+= -lm LIBS+= -lm
GAMELIBS+= -L$(FMODROOTWIN)/lib
ASFLAGS+= -DUNDERSCORES -f win32 ASFLAGS+= -DUNDERSCORES -f win32
endif endif
ifeq ($(PLATFORM),BEOS) ifeq ($(PLATFORM),BEOS)
@ -140,18 +127,11 @@ ifeq ($(RENDERTYPE),SDL)
OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0) OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
ENGINEOBJS+= $(OBJ)/gtkbits.$o $(OBJ)/dynamicgtk.$o ENGINEOBJS+= $(OBJ)/gtkbits.$o $(OBJ)/dynamicgtk.$o
EDITOROBJS+= $(OBJ)/startgtk.editor.$o EDITOROBJS+= $(OBJ)/startgtk.editor.$o
GAMEEXEOBJS+= $(OBJ)/game_banner.$o $(OBJ)/startgtk.game.$o
EDITOREXEOBJS+= $(OBJ)/editor_banner.$o
endif endif
GAMEEXEOBJS+= $(OBJ)/game_icon.$o
EDITOREXEOBJS+= $(OBJ)/build_icon.$o
endif endif
ifeq ($(RENDERTYPE),WIN) ifeq ($(RENDERTYPE),WIN)
ENGINEOBJS+= $(OBJ)/winlayer.$o ENGINEOBJS+= $(OBJ)/winlayer.$o
EDITOROBJS+= $(OBJ)/startwin.editor.$o EDITOROBJS+= $(OBJ)/startwin.editor.$o
GAMEEXEOBJS+= $(OBJ)/gameres.$(res) $(OBJ)/startwin.game.$o
EDITOREXEOBJS+= $(OBJ)/buildres.$(res)
endif endif
ifneq (0,$(EFENCE)) ifneq (0,$(EFENCE))
@ -175,12 +155,11 @@ endif
.PHONY: alldarwin .PHONY: alldarwin
alldarwin: alldarwin:
cd osx/engine && xcodebuild -target All -buildstyle $(style) cd osx/engine && xcodebuild -target All -buildstyle $(style)
cd osx/game && xcodebuild -target All -buildstyle $(style)
endif endif
UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2art$(EXESUFFIX) wad2map$(EXESUFFIX) UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2art$(EXESUFFIX) wad2map$(EXESUFFIX)
all: testgame$(EXESUFFIX) build$(EXESUFFIX) $(OBJ)/$(ENGINELIB) $(OBJ)/$(EDITORLIB) all: $(OBJ)/$(ENGINELIB) $(OBJ)/$(EDITORLIB)
utils: $(UTILS) utils: $(UTILS)
enginelib: $(OBJ)/$(ENGINELIB) enginelib: $(OBJ)/$(ENGINELIB)
@ -193,12 +172,6 @@ $(OBJ)/$(EDITORLIB): $(EDITOROBJS)
$(AR) rc $@ $^ $(AR) rc $@ $^
$(RANLIB) $@ $(RANLIB) $@
testgame$(EXESUFFIX): $(GAMEEXEOBJS)
$(CC) $(CFLAGS) $(OURCFLAGS) -o $@ $^ $(GAMELIBS) $(LIBS) $(STDCPPLIB)
build$(EXESUFFIX): $(EDITOREXEOBJS)
$(CC) $(CFLAGS) $(OURCFLAGS) -o $@ $^ $(LIBS)
pragmacheck$(EXESUFFIX): $(OBJ)/pragmacheck.$o $(OBJ)/pragmas.$o pragmacheck$(EXESUFFIX): $(OBJ)/pragmacheck.$o $(OBJ)/pragmas.$o
$(CC) $(subst -Dmain=app_main,,$(OURCFLAGS)) -o $@ $^ $(CC) $(subst -Dmain=app_main,,$(OURCFLAGS)) -o $@ $^
@ -235,7 +208,7 @@ $(OBJ)/%.$o: $(SRC)/%.cpp
$(CXX) $(CXXFLAGS) $(OURCXXFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1 $(CXX) $(CXXFLAGS) $(OURCXXFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
$(OBJ)/%.$o: $(SRC)/misc/%.rc $(OBJ)/%.$o: $(SRC)/misc/%.rc
$(RC) -i $< -o $@ --include-dir=$(INC) --include-dir=$(SRC) --include-dir=$(GAME) $(RC) -i $< -o $@ --include-dir=$(INC) --include-dir=$(SRC)
$(OBJ)/%.$o: $(SRC)/util/%.c $(OBJ)/%.$o: $(SRC)/util/%.c
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1 $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1
@ -243,15 +216,7 @@ $(OBJ)/%.$o: $(SRC)/util/%.c
$(OBJ)/%.$o: $(RSRC)/%.c $(OBJ)/%.$o: $(RSRC)/%.c
$(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1 $(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 $(OBJ)/editor_banner.$o: $(RSRC)/editor_banner.c
$(RSRC)/game_banner.c: $(RSRC)/game.bmp
echo "#include <gdk-pixbuf/gdk-pixdata.h>" > $@ echo "#include <gdk-pixbuf/gdk-pixdata.h>" > $@
gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $^ | sed 's/load_inc//' >> $@ gdk-pixbuf-csource --extern --struct --raw --name=startbanner_pixdata $^ | sed 's/load_inc//' >> $@
$(RSRC)/editor_banner.c: $(RSRC)/build.bmp $(RSRC)/editor_banner.c: $(RSRC)/build.bmp
@ -262,7 +227,6 @@ $(RSRC)/editor_banner.c: $(RSRC)/build.bmp
clean: clean:
ifeq ($(PLATFORM),DARWIN) ifeq ($(PLATFORM),DARWIN)
cd osx/engine && xcodebuild -target All clean cd osx/engine && xcodebuild -target All clean
cd osx/game && xcodebuild -target All clean
else else
-rm -f $(OBJ)/* -rm -f $(OBJ)/*
endif endif
@ -270,7 +234,7 @@ endif
veryclean: clean veryclean: clean
ifeq ($(PLATFORM),DARWIN) ifeq ($(PLATFORM),DARWIN)
else else
-rm -f $(ENGINELIB) $(EDITORLIB) testgame$(EXESUFFIX) build$(EXESUFFIX) $(UTILS) -rm -f $(ENGINELIB) $(EDITORLIB) $(UTILS)
endif endif
.PHONY: fixlineends .PHONY: fixlineends

View file

@ -28,19 +28,10 @@ $(OBJ)/gtkbits.$o: $(SRC)/gtkbits.c $(INC)/baselayer.h $(INC)/build.h $(INC)/dyn
$(OBJ)/dynamicgtk.$o: $(SRC)/dynamicgtk.c $(INC)/dynamicgtk.h $(OBJ)/dynamicgtk.$o: $(SRC)/dynamicgtk.c $(INC)/dynamicgtk.h
$(OBJ)/polymer.$o: $(SRC)/polymer.c $(INC)/polymer.h $(INC)/compat.h $(INC)/build.h $(INC)/glbuild.h $(INC)/osd.h $(INC)/polymost.h $(INC)/pragmas.h $(OBJ)/polymer.$o: $(SRC)/polymer.c $(INC)/polymer.h $(INC)/compat.h $(INC)/build.h $(INC)/glbuild.h $(INC)/osd.h $(INC)/polymost.h $(INC)/pragmas.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)/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.editor.$o: $(SRC)/startwin.editor.c $(INC)/build.h $(INC)/editor.h $(INC)/winlayer.h $(INC)/compat.h $(INC)/startwin.editor.h
$(OBJ)/startgtk.editor.$o: $(SRC)/startgtk.editor.c $(INC)/baselayer.h $(INC)/build.h $(INC)/editor.h $(INC)/compat.h $(OBJ)/startgtk.editor.$o: $(SRC)/startgtk.editor.c $(INC)/baselayer.h $(INC)/build.h $(INC)/editor.h $(INC)/compat.h
$(OBJ)/game_icon.$o: $(RSRC)/game_icon.c
$(OBJ)/build_icon.$o: $(RSRC)/build_icon.c $(OBJ)/build_icon.$o: $(RSRC)/build_icon.c
$(OBJ)/kextract.$o: $(SRC)/util/kextract.c $(INC)/compat.h $(OBJ)/kextract.$o: $(SRC)/util/kextract.c $(INC)/compat.h

View file

@ -4,7 +4,6 @@
!endif !endif
SRC=src SRC=src
GAME=game
!ifndef OBJ !ifndef OBJ
OBJ=obj.msc OBJ=obj.msc
!endif !endif
@ -43,7 +42,6 @@ AS=ml
RC=rc RC=rc
LINK=link /opt:nowin98 /opt:ref /nologo LINK=link /opt:nowin98 /opt:ref /nologo
CFLAGS=$(CFLAGS) /nologo /MD /J $(flags_cl) $(TARGETOPTS) /I$(INC) /I$(DXROOT)\include /I$(FMODROOT)\inc CFLAGS=$(CFLAGS) /nologo /MD /J $(flags_cl) $(TARGETOPTS) /I$(INC) /I$(DXROOT)\include /I$(FMODROOT)\inc
GAMECFLAGS=/I$(GAME)
LIBS=fmodvc.lib #opengl32.lib LIBS=fmodvc.lib #opengl32.lib
ASFLAGS=/nologo /coff ASFLAGS=/nologo /coff
EXESUFFIX=.exe EXESUFFIX=.exe
@ -71,18 +69,6 @@ EDITOROBJS=$(OBJ)\build.$o \
$(OBJ)\startwin.editor.$o \ $(OBJ)\startwin.editor.$o \
$(OBJ)\config.$o $(OBJ)\config.$o
GAMEEXEOBJS=$(OBJ)\config.$o \
$(OBJ)\game.$o \
$(OBJ)\gameres.$(res) \
$(OBJ)\startwin.game.$o \
$(OBJ)\sound.$o \
$(OBJ)\$(ENGINELIB)
EDITOREXEOBJS=$(OBJ)\bstub.$o \
$(OBJ)\buildres.$(res) \
$(OBJ)\$(EDITORLIB) \
$(OBJ)\$(ENGINELIB)
RENDERTYPE=WIN RENDERTYPE=WIN
LIBS=$(LIBS) user32.lib gdi32.lib shell32.lib dxguid.lib wsock32.lib comctl32.lib LIBS=$(LIBS) user32.lib gdi32.lib shell32.lib dxguid.lib wsock32.lib comctl32.lib
CFLAGS=$(CFLAGS) /DRENDERTYPE$(RENDERTYPE)=1 CFLAGS=$(CFLAGS) /DRENDERTYPE$(RENDERTYPE)=1
@ -100,7 +86,7 @@ CFLAGS=$(CFLAGS) /DRENDERTYPE$(RENDERTYPE)=1
$(CC) /c $(CFLAGS) /Fo$@ $< $(CC) /c $(CFLAGS) /Fo$@ $<
{$(SRC)\misc}.rc{$(OBJ)}.$(res): {$(SRC)\misc}.rc{$(OBJ)}.$(res):
$(RC) /i$(INC)\ /i$(GAME)\ /fo$@ /r $< $(RC) /i$(INC)\ /fo$@ /r $<
{$(SRC)}.c{$(OBJ)}.$o: {$(SRC)}.c{$(OBJ)}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $< $(CC) /c $(CFLAGS) /Fo$@ $<
@ -108,16 +94,10 @@ CFLAGS=$(CFLAGS) /DRENDERTYPE$(RENDERTYPE)=1
{$(SRC)}.cpp{$(OBJ)}.$o: {$(SRC)}.cpp{$(OBJ)}.$o:
$(CC) /c $(CFLAGS) /Fo$@ $< $(CC) /c $(CFLAGS) /Fo$@ $<
{$(GAME)}.c{$(OBJ)}.$o:
$(CC) /c $(CFLAGS) $(GAMECFLAGS) /Fo$@ $<
{$(GAME)}.cpp{$(OBJ)}.$o:
$(CC) /c $(CFLAGS) $(GAMECFLAGS) /Fo$@ $<
# TARGETS # TARGETS
UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2map$(EXESUFFIX) wad2map$(EXESUFFIX) UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2map$(EXESUFFIX) wad2map$(EXESUFFIX)
all: game$(EXESUFFIX) build$(EXESUFFIX) ; all: ;
utils: $(UTILS) ; utils: $(UTILS) ;
enginelib: $(OBJ)\$(ENGINELIB) ; enginelib: $(OBJ)\$(ENGINELIB) ;
@ -128,13 +108,6 @@ editorlib: $(OBJ)\$(EDITORLIB) ;
$(OBJ)\$(EDITORLIB): $(EDITOROBJS) $(OBJ)\$(EDITORLIB): $(EDITOROBJS)
lib /out:$@ /nologo $** lib /out:$@ /nologo $**
game$(EXESUFFIX): $(GAMEEXEOBJS)
$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(DXROOT)\lib /LIBPATH:$(FMODROOT)\lib $(flags_link) /MAP $** $(LIBS) msvcrt.lib
build$(EXESUFFIX): $(EDITOREXEOBJS)
$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS /LIBPATH:$(DXROOT)\lib /LIBPATH:$(FMODROOT)\lib $(flags_link) /MAP $** $(LIBS) msvcrt.lib
# the tools # the tools
kextract$(EXESUFFIX): $(OBJ)\kextract.$o $(OBJ)\compat.$o kextract$(EXESUFFIX): $(OBJ)\kextract.$o $(OBJ)\compat.$o
$(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** msvcrt.lib $(LINK) /OUT:$@ /SUBSYSTEM:CONSOLE $(flags_link) /MAP $** msvcrt.lib
@ -156,7 +129,7 @@ wad2art$(EXESUFFIX): $(OBJ)\wad2art.$o $(OBJ)\pragmas.$o $(OBJ)\compat.$o
# PHONIES # PHONIES
clean: clean:
-del $(ENGINEOBJS) $(EDITOROBJS) $(GAMEEXEOBJS) $(EDITOREXEOBJS) -del $(ENGINEOBJS) $(EDITOROBJS)
veryclean: clean veryclean: clean
-del $(OBJ)\$(ENGINELIB) $(OBJ)\$(EDITORLIB) game$(EXESUFFIX) build$(EXESUFFIX) $(UTILS) -del $(OBJ)\$(ENGINELIB) $(OBJ)\$(EDITORLIB) $(UTILS)

View file

@ -5,7 +5,6 @@
!endif !endif
SRC=src SRC=src
GAME=game
!ifndef OBJ !ifndef OBJ
OBJ=obj.watcom OBJ=obj.watcom
!endif !endif
@ -38,7 +37,6 @@ AS=wasm
RC=wrc RC=wrc
CFLAGS+= -zq -5r -s -orb -fp5 $(TARGETOPTS) -d2 -dRENDERTYPEWIN=1 & CFLAGS+= -zq -5r -s -orb -fp5 $(TARGETOPTS) -d2 -dRENDERTYPEWIN=1 &
-i=$(INC) -i=$(SRC) -i=$(DXROOT)\include -i=..\jfaud\inc -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 LIBS=dxguid.lib wsock32.lib ..\jfaud\jfaud.lib winmm.lib #opengl32.lib
ASFLAGS=# -d1 ASFLAGS=# -d1
EXESUFFIX=.exe EXESUFFIX=.exe
@ -66,21 +64,12 @@ EDITOROBJS=$(OBJ)\build.$o &
$(OBJ)\config.$o & $(OBJ)\config.$o &
$(OBJ)\startwin.editor.$o $(OBJ)\startwin.editor.$o
GAMEEXEOBJS=$(OBJ)\game.$o &
$(OBJ)\jfaud_sound.$o &
$(OBJ)\config.$o &
$(OBJ)\startwin.game.$o
EDITOREXEOBJS=$(OBJ)\bstub.$o
# RULES # RULES
.EXTENSIONS: .wasm .res .rc .EXTENSIONS: .wasm .res .rc
.wasm: $(SRC) .wasm: $(SRC)
.c: $(SRC) .c: $(SRC)
.cpp: $(SRC) .cpp: $(SRC)
.c: $(GAME)
.cpp: $(GAME)
.c: $(SRC)\util .c: $(SRC)\util
.rc: $(SRC)\misc .rc: $(SRC)\misc
@ -89,16 +78,14 @@ EDITOREXEOBJS=$(OBJ)\bstub.$o
.c.$o: .c.$o:
$(CC) $(CFLAGS) -fo=$(OBJ)\.$o $[@ $(CC) $(CFLAGS) -fo=$(OBJ)\.$o $[@
.cpp.$o:
$(CXX) $(CFLAGS) $(GAMECFLAGS) -fo=$(OBJ)\.$o $[@
.rc.$(res): .rc.$(res):
$(RC) -i=$(SRC) -i=$(INC) -i=$(GAME) -fo=$^*.$(res) -r $[@ $(RC) -i=$(SRC) -i=$(INC) -fo=$^*.$(res) -r $[@
# TARGETS # TARGETS
UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2art$(EXESUFFIX) wad2map$(EXESUFFIX) UTILS=kextract$(EXESUFFIX) kgroup$(EXESUFFIX) transpal$(EXESUFFIX) wad2art$(EXESUFFIX) wad2map$(EXESUFFIX)
all: game$(EXESUFFIX) build$(EXESUFFIX) .SYMBOLIC all: .SYMBOLIC
%null %null
utils: $(UTILS) .SYMBOLIC utils: $(UTILS) .SYMBOLIC
@ -122,30 +109,6 @@ $(OBJ)\$(EDITORLIB): $(EDITOROBJS)
wlib -b -n $^* @$(OBJ)\$(EDITORLIB).tmp wlib -b -n $^* @$(OBJ)\$(EDITORLIB).tmp
erase $(OBJ)\$(EDITORLIB).tmp erase $(OBJ)\$(EDITORLIB).tmp
game$(EXESUFFIX): $(GAMEEXEOBJS) $(OBJ)\gameres.$(res) $(OBJ)\$(ENGINELIB)
wlink NAME $@ &
SYSTEM WIN95 &
DEBUG ALL &
OPTION MAP &
FILE { $(GAMEEXEOBJS) } &
RESOURCE $(OBJ)\gameres.$(res) &
LIBPATH $(DXROOT)\lib &
LIBPATH $(FMODROOT)\lib &
LIBPATH $(OBJ) &
LIBRARY { $(ENGINELIB) $(LIBS) }
build$(EXESUFFIX): $(EDITOREXEOBJS) $(OBJ)\buildres.$(res) $(OBJ)\$(ENGINELIB) $(OBJ)\$(EDITORLIB)
wlink NAME $@ &
SYSTEM WIN95 &
DEBUG ALL &
OPTION MAP &
FILE { $(EDITOREXEOBJS) } &
RESOURCE $(OBJ)\buildres.$(res) &
LIBPATH $(DXROOT)\lib &
LIBPATH $(FMODROOT)\lib &
LIBPATH $(OBJ) &
LIBRARY { $(ENGINELIB) $(EDITORLIB) $(LIBS) }
kextract$(EXESUFFIX): $(OBJ)\kextract.$o $(OBJ)\compat.$o kextract$(EXESUFFIX): $(OBJ)\kextract.$o $(OBJ)\compat.$o
wlink NAME $@ SYSTEM 386 DEBUG ALL FILE { $< } wlink NAME $@ SYSTEM 386 DEBUG ALL FILE { $< }
kgroup$(EXESUFFIX): $(OBJ)\kgroup.$o $(OBJ)\compat.$o kgroup$(EXESUFFIX): $(OBJ)\kgroup.$o $(OBJ)\compat.$o
@ -162,5 +125,5 @@ wad2map$(EXESUFFIX): $(OBJ)\wad2map.$o $(OBJ)\pragmas.$o $(OBJ)\compat.$o
# PHONIES # PHONIES
clean: .SYMBOLIC clean: .SYMBOLIC
-erase /q $(OBJ)\* game$(EXESUFFIX) build$(EXESUFFIX) $(UTILS) *.err -erase /q $(OBJ)\* $(UTILS) *.err

View file

@ -470,16 +470,16 @@ void grabmouse(char a)
{ {
if (appactive && moustat) { if (appactive && moustat) {
if (a != mouseacquired) { if (a != mouseacquired) {
#ifndef DEBUGGINGAIDS // #ifndef DEBUGGINGAIDS
SDL_GrabMode g; SDL_GrabMode g;
g = SDL_WM_GrabInput( a ? SDL_GRAB_ON : SDL_GRAB_OFF ); g = SDL_WM_GrabInput( a ? SDL_GRAB_ON : SDL_GRAB_OFF );
mouseacquired = (g == SDL_GRAB_ON); mouseacquired = (g == SDL_GRAB_ON);
SDL_ShowCursor(mouseacquired ? SDL_DISABLE : SDL_ENABLE); SDL_ShowCursor(mouseacquired ? SDL_DISABLE : SDL_ENABLE);
#else // #else
mouseacquired = a; // mouseacquired = a;
#endif // #endif
} }
} else { } else {
mouseacquired = a; mouseacquired = a;

View file

@ -1,189 +0,0 @@
#import <Cocoa/Cocoa.h>
#include "baselayer.h"
@interface StartupWinController : NSWindowController
{
IBOutlet NSButton *alwaysShowButton;
IBOutlet NSButton *fullscreenButton;
IBOutlet NSTextView *messagesView;
IBOutlet NSTabView *tabView;
IBOutlet NSComboBox *videoModeCbox;
IBOutlet NSButton *cancelButton;
IBOutlet NSButton *startButton;
}
- (IBAction)alwaysShowClicked:(id)sender;
- (IBAction)fullscreenClicked:(id)sender;
- (IBAction)cancel:(id)sender;
- (IBAction)start:(id)sender;
- (void)setupRunMode;
- (void)setupMessagesMode;
- (void)putsMessage:(NSString *)str;
- (void)setTitle:(NSString *)str;
@end
@implementation StartupWinController
- (IBAction)alwaysShowClicked:(id)sender
{
}
- (IBAction)fullscreenClicked:(id)sender
{
// XXX: recalculate the video modes list to take into account the fullscreen status
}
- (IBAction)cancel:(id)sender
{
[NSApp abortModal];
}
- (IBAction)start:(id)sender
{
// XXX: write the states of the form controls to their respective homes
[NSApp stopModal];
}
- (void)setupRunMode
{
// XXX: populate the lists and set everything up to represent the current options
// enable all the controls on the Configuration page
NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator];
NSControl *control;
while (control = [enumerator nextObject])
[control setEnabled:true];
[cancelButton setEnabled:true];
[startButton setEnabled:true];
[tabView selectTabViewItemAtIndex:0];
}
- (void)setupMessagesMode
{
[tabView selectTabViewItemAtIndex:1];
// disable all the controls on the Configuration page except "always show", so the
// user can enable it if they want to while waiting for something else to happen
NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator];
NSControl *control;
while (control = [enumerator nextObject]) {
if (control == alwaysShowButton) continue;
[control setEnabled:false];
}
[cancelButton setEnabled:false];
[startButton setEnabled:false];
}
- (void)putsMessage:(NSString *)str
{
NSRange end;
NSTextStorage *text = [messagesView textStorage];
BOOL shouldAutoScroll;
shouldAutoScroll = ((int)NSMaxY([messagesView bounds]) == (int)NSMaxY([messagesView visibleRect]));
end.location = [text length];
end.length = 0;
[text beginEditing];
[messagesView replaceCharactersInRange:end withString:str];
[text endEditing];
if (shouldAutoScroll) {
end.location = [text length];
end.length = 0;
[messagesView scrollRangeToVisible:end];
}
}
- (void)setTitle:(NSString *)str
{
[[self window] setTitle:str];
}
@end
static StartupWinController *startwin = nil;
int startwin_open(void)
{
if (startwin != nil) return 1;
startwin = [[StartupWinController alloc] initWithWindowNibName:@"startwin.game"];
if (startwin == nil) return -1;
[startwin showWindow:nil];
[startwin setupMessagesMode];
return 0;
}
int startwin_close(void)
{
if (startwin == nil) return 1;
[startwin close];
startwin = nil;
return 0;
}
int startwin_puts(const char *s)
{
NSString *ns;
if (!s) return -1;
if (startwin == nil) return 1;
ns = [[NSString alloc] initWithCString:s];
[startwin putsMessage:ns];
[ns release];
return 0;
}
int startwin_settitle(const char *s)
{
NSString *ns;
if (!s) return -1;
if (startwin == nil) return 1;
ns = [[NSString alloc] initWithCString:s];
[startwin setTitle:ns];
[ns release];
return 0;
}
int startwin_idle(void *v)
{
if (startwin) [[startwin window] displayIfNeeded];
return 0;
}
int startwin_run(void)
{
int retval;
if (startwin == nil) return 0;
[startwin setupRunMode];
switch ([NSApp runModalForWindow:[startwin window]]) {
case NSRunStoppedResponse: retval = 1; break;
case NSRunAbortedResponse: retval = 0; break;
default: retval = -1;
}
[startwin setupMessagesMode];
return retval;
}

View file

@ -1,564 +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 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:
*/

File diff suppressed because it is too large Load diff

View file

@ -1,56 +0,0 @@
// game.h
void operatesector(short dasector);
void operatesprite(short dasprite);
long changehealth(short snum, short deltahealth);
void changenumbombs(short snum, short deltanumbombs);
void changenummissiles(short snum, short deltanummissiles);
void changenumgrabbers(short snum, short deltanumgrabbers);
void drawstatusflytime(short snum);
void drawstatusbar(short snum);
void prepareboard(char *daboardfilename);
void checktouchsprite(short snum, short sectnum);
void checkgrabbertouchsprite(short snum, short sectnum);
void shootgun(short snum, long x, long y, long z, short daang, long dahoriz, short dasectnum, char guntype);
void analyzesprites(long dax, long day);
void tagcode(void);
void statuslistcode(void);
void activatehitag(short dahitag);
void bombexplode(long i);
void processinput(short snum);
void view(short snum, long *vx, long *vy, long *vz, short *vsectnum, short ang, long horiz);
void updatesectorz(long x, long y, long z, short *sectnum);
void drawscreen(short snum, long dasmoothratio);
void movethings(void);
void fakedomovethings(void);
void fakedomovethingscorrect(void);
void domovethings(void);
void getinput(void);
void initplayersprite(short snum);
void playback(void);
void setup3dscreen(void);
void findrandomspot(long *x, long *y, short *sectnum);
void warp(long *x, long *y, long *z, short *daang, short *dasector);
void warpsprite(short spritenum);
void initlava(void);
void movelava(char *dapic);
void doanimations(void);
long getanimationgoal(long animptr);
long setanimation(long *animptr, long thegoal, long thevel, long theacc);
void checkmasterslaveswitch(void);
long testneighborsectors(short sect1, short sect2);
long loadgame(void);
long savegame(void);
void faketimerhandler(void);
void getpackets(void);
void drawoverheadmap(long cposx, long cposy, long czoom, short cang);
long movesprite(short spritenum, long dx, long dy, long dz, long ceildist, long flordist, long clipmask);
void waitforeverybody(void);
void searchmap(short startsector);
void setinterpolation(long *posptr);
void stopinterpolation(long *posptr);
void updateinterpolations(void);
void dointerpolations(void);
void restoreinterpolations(void);
void printext(long x, long y, char *buffer, short tilenum, char invisiblecol);
void drawtilebackground (long thex, long they, short tilenum, signed char shade, long cx1, long cy1, long cx2, long cy2, char dapalnum);

View file

@ -1,378 +0,0 @@
#include <ctype.h>
#include "compat.h"
#include "baselayer.h"
#include "cache1d.h"
typedef uint64 uint64_t;
#ifdef __APPLE__
# include <jfaud/jfaud.hpp>
#else
# include "jfaud.hpp"
#endif
extern "C" {
void initsb(char,char,long,char,char,char,char);
void uninitsb(void);
void setears(long,long,long,long);
void wsayfollow(char *,long,long,long *,long *,char);
void wsay(char *,long,long,long);
void loadwaves(void);
void loadsong(char *);
void musicon(void);
void musicoff(void);
void refreshaudio(void);
}
#define NUMCHANNELS 16
#define UNITSPERMTR 640.0
#define WAVESFILE "WAVES.KWV"
static char musistat = 0;
static char songname[BMAX_PATH] = "";
static JFAud *jfaud = NULL;
static int kwvnumwaves = 0;
static struct _kwvitem {
char instname[16];
long wavleng;
long repstart;
long repleng;
long finetune;
long datastart;
} *kwvitems = NULL;
static struct {
long *posx, *posy;
JFAudMixerChannel *handle;
} sfxchans[NUMCHANNELS];
class KenFile : public JFAudFile {
private:
int fh;
public:
KenFile(const char *filename, const char *subfilename)
: JFAudFile(filename, subfilename)
{
fh = kopen4load(const_cast<char*>(filename), 0);
}
virtual ~KenFile()
{
if (fh >= 0) kclose(fh);
}
virtual bool IsOpen(void) const { return fh >= 0; }
virtual long Read(long nbytes, void *buf)
{
if (fh < 0) return -1;
return kread(fh, buf, nbytes);
}
virtual long Seek(long pos, SeekFrom where)
{
int when;
if (fh < 0) return -1;
switch (where) {
case JFAudFile::Set: when = SEEK_SET; break;
case JFAudFile::Cur: when = SEEK_CUR; break;
case JFAudFile::End: when = SEEK_END; break;
default: return -1;
}
return klseek(fh, pos, when);
}
virtual long Tell(void) const
{
if (fh < 0) return -1;
return klseek(fh, 0, SEEK_CUR);
}
virtual long Length(void) const
{
if (fh < 0) return -1;
return kfilelength(fh);
}
};
class KWVFile : public JFAudFile {
private:
int fh;
long datastart, datalen, datapos;
public:
KWVFile(const char *filename, const char *subfilename = NULL)
: JFAudFile(filename, NULL),
datastart(-1), datalen(-1), datapos(-1)
{
long i,j;
bool found = false;
if (!subfilename) return;
for (i=0;i<kwvnumwaves;i++) {
for (j=0;j<16 && subfilename[j];j++) {
if (tolower(subfilename[j]) != tolower(kwvitems[i].instname[j])) {
found = false;
break;
} else found = true;
}
if (found) {
fh = kopen4load(const_cast<char *>(filename), 0);
if (fh < 0) return;
datastart = kwvitems[i].datastart;
datalen = kwvitems[i].wavleng;
datapos = 0;
klseek(fh, datastart, SEEK_SET);
return;
}
}
}
virtual ~KWVFile()
{
if (fh >= 0) kclose(fh);
}
virtual bool IsOpen(void) const
{
return datalen > 0 && fh >= 0;
}
virtual long Read(long nbytes, void *buf)
{
if (!IsOpen()) return -1;
if (datalen - datapos < nbytes) nbytes = datalen - datapos;
if (nbytes <= 0) return 0;
nbytes = kread(fh, buf, nbytes);
if (nbytes > 0) datapos += nbytes;
return nbytes;
}
virtual long Seek(long pos, SeekFrom where)
{
long newpos;
if (!IsOpen()) return -1;
switch (where) {
case JFAudFile::Set: newpos = pos; break;
case JFAudFile::Cur: newpos = datapos + pos; break;
case JFAudFile::End: newpos = datalen + pos; break;
default: return -1;
}
if (newpos < 0) newpos = 0;
else if (newpos > datalen) newpos = datalen;
return klseek(fh, datastart + newpos, SEEK_SET);
}
virtual long Tell(void) const
{
if (!IsOpen()) return -1;
return datapos;
}
virtual long Length(void) const
{
if (!IsOpen()) return -1;
return datalen;
}
};
static JFAudFile *openfile(const char *fn, const char *subfn)
{
char *ext;
bool loadkwv = false;
ext = Bstrrchr(fn,'.');
if (!ext || Bstrcasecmp(ext, ".kwv"))
return static_cast<JFAudFile*>(new KenFile(fn,subfn));
if (!subfn) return NULL; // KWV files need a sub name
return static_cast<JFAudFile*>(new KWVFile(fn, subfn));
}
static void logfunc(const char *s) { initprintf("%s", s); }
void loadwaves(void)
{
long fh, i, datastart;
fh = kopen4load(WAVESFILE, 0);
if (fh < 0) return;
if (kread(fh, &i, 4) != 4 || i != 0) return;
if (kread(fh, &kwvnumwaves, 4) != 4) return; kwvnumwaves = B_LITTLE32(kwvnumwaves);
kwvitems = new struct _kwvitem [kwvnumwaves];
if (!kwvitems) {
kclose(fh);
return;
}
datastart = (4+4) + kwvnumwaves * (16+4*4);
for (i=0;i<kwvnumwaves;i++) {
if (kread(fh, kwvitems[i].instname, 16) != 16) return;
if (kread(fh, &kwvitems[i].wavleng, 4) != 4) return; kwvitems[i].wavleng = B_LITTLE32(kwvitems[i].wavleng);
if (kread(fh, &kwvitems[i].repstart, 4) != 4) return; kwvitems[i].repstart = B_LITTLE32(kwvitems[i].repstart);
if (kread(fh, &kwvitems[i].repleng, 4) != 4) return; kwvitems[i].repleng = B_LITTLE32(kwvitems[i].repleng);
if (kread(fh, &kwvitems[i].finetune, 4) != 4) return; kwvitems[i].finetune = B_LITTLE32(kwvitems[i].finetune);
kwvitems[i].datastart = datastart;
datastart += kwvitems[i].wavleng;
}
kclose(fh);
}
void initsb(char dadigistat, char damusistat, long dasamplerate, char danumspeakers,
char dabytespersample, char daintspersec, char daquality)
{
int i;
if (jfaud) return;
JFAud_SetLogFunc(logfunc);
jfaud = new JFAud();
if (!jfaud) return;
jfaud->SetUserOpenFunc(openfile);
musistat = 0;
if (!jfaud->InitWave(NULL, NUMCHANNELS, dasamplerate)) {
delete jfaud;
jfaud = NULL;
return;
}
musistat = damusistat;
for (i=NUMCHANNELS-1;i>=0;i--) sfxchans[i].handle = NULL;
loadwaves();
}
void uninitsb(void)
{
if (!jfaud) return;
delete jfaud;
jfaud = NULL;
if (kwvitems) delete [] kwvitems;
}
void setears(long daposx, long daposy, long daxvect, long dayvect)
{
JFAudMixer *mixer;
if (!jfaud) return;
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);
}
static int storehandle(JFAudMixerChannel *handle, long *daxplc, long *dayplc)
{
int i,empty = -1;
for (i=NUMCHANNELS-1;i>=0;i--) {
if (!sfxchans[i].handle && empty<0) empty = i;
if (sfxchans[i].handle == handle) {
empty = i;
break;
}
}
if (empty < 0) return -1;
sfxchans[empty].handle = handle;
sfxchans[empty].posx = daxplc;
sfxchans[empty].posy = dayplc;
return empty;
}
static void stopcb(int r)
{
jfaud->FreeSound(sfxchans[r].handle);
sfxchans[r].handle = NULL;
}
void wsayfollow(char *dafilename, long dafreq, long davol, long *daxplc, long *dayplc, char followstat)
{
JFAudMixerChannel *handl;
int r;
if (!jfaud) return;
handl = jfaud->PlayRawSound(WAVESFILE, dafilename, 1, 11025, 1, 1, false);
if (!handl) return;
if (followstat) r = storehandle(handl, daxplc, dayplc);
else r = storehandle(handl, NULL, NULL);
if (r >= 0) handl->SetStopCallback(stopcb, r);
handl->SetPitch((float)dafreq / 4096.0);
handl->SetGain((float)davol / 256.0);
handl->SetPosition((float)(*daxplc) / UNITSPERMTR, 0.0, (float)(*dayplc) / UNITSPERMTR);
handl->SetFollowListener(false);
handl->SetRolloff(1.0);
handl->Play();
}
void wsay(char *dafilename, long dafreq, long volume1, long volume2)
{
JFAudMixerChannel *handl;
int r;
if (!jfaud) return;
handl = jfaud->PlayRawSound(WAVESFILE, dafilename, 1, 11025, 1, 1, false);
if (!handl) return;
r = storehandle(handl, NULL, NULL);
if (r >= 0) handl->SetStopCallback(stopcb, r);
handl->SetPitch((float)dafreq / 4096.0);
handl->SetGain((float)volume1 / 256.0);
handl->SetPosition(0.0, 0.0, 0.0);
handl->SetFollowListener(true);
handl->SetRolloff(0.0);
handl->Play();
}
void loadsong(char *filename)
{
if (!jfaud) return;
strcpy(songname,filename);
}
void musicon(void)
{
if (!jfaud || !musistat || !songname[0]) return;
jfaud->PlayMusic(songname);
}
void musicoff(void)
{
if (!jfaud || !musistat) return;
jfaud->StopMusic();
}
void refreshaudio(void)
{
int i;
if (!jfaud) return;
for (i=NUMCHANNELS-1;i>=0;i--) {
if (!sfxchans[i].handle || !jfaud->IsValidSound(sfxchans[i].handle)) continue;
if (!sfxchans[i].posx || !sfxchans[i].posy) continue;
sfxchans[i].handle->SetPosition(
(float)(*sfxchans[i].posx)/UNITSPERMTR,
0.0,
(float)(*sfxchans[i].posy)/UNITSPERMTR);
}
jfaud->Update();
}

View file

@ -1,49 +0,0 @@
//Be careful when changing this file - it is parsed by Editart and Build.
#define SWITCH1ON 15
#define SLIME 34
#define BACKGROUND 37
#define KENPICTURE 48
#define BUILDDISK 49
#define SWITCH2ON 66
#define SWITCH2OFF 69
#define ALPHABET 73
#define NO 74
#define DEMOSIGN 75
#define COIN 76
#define COINSTACK 77
#define GIFTBOX 78
#define DIAMONDS 79
#define EVILALGRAVE 83
#define STATUSBAR 87
#define DAYSKY 89
#define WATERFOUNTAIN 90
#define USEWATERFOUNTAIN 91
#define NIGHTSKY 93
#define BULLET 98
#define BOMB 100
#define CANNON 101
#define GUNONBOTTOM 102
#define BOMBEMITTER 103
#define EXPLOSION 105
#define SPLASH 106
#define BROWNMONSTER 110
#define SKELETON 113
#define AL 114
#define EVILAL 115
#define PLAYER 120
#define SWITCH3OFF 146
#define SWITCH3ON 147
#define AIRPLANE 148
#define SPIRAL 149
#define COMPASS 150
#define FOOTPRINT 156
#define STATUSBARFILL8 160
#define STATUSBARFILL4 161
#define BOUNCYMAT 162
#define MIRROR 165
#define FLOORMIRROR 166
#define GRABBER 167
#define GRABCANNON 168
#define MISSILE 169
#define LAUNCHER 171
#define MIRRORLABEL 4000

View file

@ -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;
}

View file

@ -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;
}

View file

@ -1,18 +0,0 @@
// resource ids
#define WIN_STARTWIN 1000
#define WIN_STARTWINPAGE_CONFIG 2000
#define WIN_STARTWIN_BITMAP 100 // banner bitmap
#define WIN_STARTWIN_TABCTL 101
#define WIN_STARTWIN_CANCEL IDCANCEL
#define WIN_STARTWIN_START IDOK
#define WIN_STARTWIN_MESSAGES 104 // output list box
#define RSRC_ICON 100
#define RSRC_BMP 200
// config page
#define IDCFULLSCREEN 100
#define IDC3DVMODE 101
#define IDCALWAYSSHOW 102