Skip to content

Commit

Permalink
include_p1xbraten_menus -> include_p1xbraten_cfgs
Browse files Browse the repository at this point in the history
  • Loading branch information
sauerbraten committed Apr 12, 2021
1 parent f65eb9a commit e5b1ef1
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 66 deletions.
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ apply-patches:
$(PATCH) < patches/listteams.patch
$(PATCH) < patches/extrapings.patch
$(PATCH) < patches/execfile.patch
$(PATCH) < patches/include_p1xbraten_menus.patch
$(PATCH) < patches/include_p1xbraten_cfgs.patch
$(PATCH) < patches/tex_commands.patch
$(PATCH) < patches/decouple_framedrawing.patch
$(PATCH) < patches/crosshaircolor.patch
Expand All @@ -50,12 +50,12 @@ gzip-menus:
gzip --keep --force --best --no-name data/p1xbraten/gamehud.cfg && xxd -i - data/p1xbraten/gamehud.cfg.gz.xxd < data/p1xbraten/gamehud.cfg.gz

_include-menus:
sed -i "s/0,\/\/menuscrc/0x$(shell crc32 data/p1xbraten/menus.cfg),/" src/fpsgame/p1xbraten_menus.cpp
sed -i "s/embeddedfile<0> menuscfg/embeddedfile<$(shell stat --printf="%s" data/p1xbraten/menus.cfg.gz)> menuscfg/" src/fpsgame/p1xbraten_menus.cpp
sed -i "s/0,\/\/mastercrc/0x$(shell crc32 data/p1xbraten/master.cfg),/" src/fpsgame/p1xbraten_menus.cpp
sed -i "s/embeddedfile<0> mastercfg/embeddedfile<$(shell stat --printf="%s" data/p1xbraten/master.cfg.gz)> mastercfg/" src/fpsgame/p1xbraten_menus.cpp
sed -i "s/0,\/\/gamehudcrc/0x$(shell crc32 data/p1xbraten/gamehud.cfg),/" src/fpsgame/p1xbraten_menus.cpp
sed -i "s/embeddedfile<0> gamehudcfg/embeddedfile<$(shell stat --printf="%s" data/p1xbraten/gamehud.cfg.gz)> gamehudcfg/" src/fpsgame/p1xbraten_menus.cpp
sed -i "s/0,\/\/menuscrc/0x$(shell crc32 data/p1xbraten/menus.cfg),/" src/fpsgame/p1xbraten_cfgs.cpp
sed -i "s/embeddedfile<0> menuscfg/embeddedfile<$(shell stat --printf="%s" data/p1xbraten/menus.cfg.gz)> menuscfg/" src/fpsgame/p1xbraten_cfgs.cpp
sed -i "s/0,\/\/mastercrc/0x$(shell crc32 data/p1xbraten/master.cfg),/" src/fpsgame/p1xbraten_cfgs.cpp
sed -i "s/embeddedfile<0> mastercfg/embeddedfile<$(shell stat --printf="%s" data/p1xbraten/master.cfg.gz)> mastercfg/" src/fpsgame/p1xbraten_cfgs.cpp
sed -i "s/0,\/\/gamehudcrc/0x$(shell crc32 data/p1xbraten/gamehud.cfg),/" src/fpsgame/p1xbraten_cfgs.cpp
sed -i "s/embeddedfile<0> gamehudcfg/embeddedfile<$(shell stat --printf="%s" data/p1xbraten/gamehud.cfg.gz)> gamehudcfg/" src/fpsgame/p1xbraten_cfgs.cpp

clean-sauer: check-env
cd $(SAUER_DIR) && \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
Index: src/Makefile
===================================================================
--- src/Makefile (revision 6490)
--- src/Makefile (revision 6496)
+++ src/Makefile (working copy)
@@ -127,6 +127,7 @@
fpsgame/fps.o \
fpsgame/monster.o \
fpsgame/movable.o \
+ fpsgame/p1xbraten_menus.o \
+ fpsgame/p1xbraten_cfgs.o \
fpsgame/render.o \
fpsgame/scoreboard.o \
fpsgame/server.o \
Index: src/fpsgame/p1xbraten_menus.cpp
Index: src/engine/main.cpp
===================================================================
--- src/fpsgame/p1xbraten_menus.cpp (nonexistent)
+++ src/fpsgame/p1xbraten_menus.cpp (working copy)
@@ -0,0 +1,79 @@
--- src/engine/main.cpp (revision 6496)
+++ src/engine/main.cpp (working copy)
@@ -1299,6 +1299,7 @@
defformatstring(gamecfgname, "data/game_%s.cfg", game::gameident());
execfile(gamecfgname);
if(game::savedservers()) execfile(game::savedservers(), false);
+ game::writep1xbratencfgs();

identflags |= IDF_PERSIST;

Index: src/fpsgame/p1xbraten_cfgs.cpp
===================================================================
--- src/fpsgame/p1xbraten_cfgs.cpp (nonexistent)
+++ src/fpsgame/p1xbraten_cfgs.cpp (working copy)
@@ -0,0 +1,66 @@
+#include "cube.h"
+#include "p1xbraten_menus.h"
+#include "p1xbraten_cfgs.h"
+
+namespace game {
+ struct embeddedfile<0> menuscfg = {
Expand Down Expand Up @@ -62,17 +74,8 @@ Index: src/fpsgame/p1xbraten_menus.cpp
+ return 0;
+ }
+
+ extern int usep1xbratenmenus;
+
+ void executep1xbratenmenufiles()
+ {
+ if(usep1xbratenmenus) execfile(menuscfg.name);
+ }
+
+ int writep1xbratenmenufiles()
+ int writep1xbratencfgs()
+ {
+ if(!usep1xbratenmenus) return 1;
+
+ int err = update(&menuscfg);
+ if(err) { conoutf("\f6error updating %s (error code %d)!", menuscfg.name, err); return err; }
+
Expand All @@ -86,18 +89,14 @@ Index: src/fpsgame/p1xbraten_menus.cpp
+ }
+
+ VARFP(usep1xbratenmenus, 0, 1, 1, {
+ if(usep1xbratenmenus)
+ {
+ writep1xbratenmenufiles();
+ executep1xbratenmenufiles();
+ }
+ if(usep1xbratenmenus) execfile(menuscfg.name);
+ else execfile("data/menus.cfg");
+ });
+}
Index: src/fpsgame/p1xbraten_menus.h
Index: src/fpsgame/p1xbraten_cfgs.h
===================================================================
--- src/fpsgame/p1xbraten_menus.h (nonexistent)
+++ src/fpsgame/p1xbraten_menus.h (working copy)
--- src/fpsgame/p1xbraten_cfgs.h (nonexistent)
+++ src/fpsgame/p1xbraten_cfgs.h (working copy)
@@ -0,0 +1,10 @@
+#include "cube.h"
+
Expand All @@ -112,20 +111,19 @@ Index: src/fpsgame/p1xbraten_menus.h
\ No newline at end of file
Index: src/shared/igame.h
===================================================================
--- src/shared/igame.h (revision 6490)
--- src/shared/igame.h (revision 6496)
+++ src/shared/igame.h (working copy)
@@ -48,6 +48,8 @@
@@ -48,6 +48,7 @@
extern const char *autoexec();
extern const char *savedservers();
extern void loadconfigs();
+ extern int writep1xbratenmenufiles();
+ extern void executep1xbratenmenufiles();
+ extern int writep1xbratencfgs();

extern void updateworld();
extern void initclient();
Index: src/shared/stream.cpp
===================================================================
--- src/shared/stream.cpp (revision 6490)
--- src/shared/stream.cpp (revision 6496)
+++ src/shared/stream.cpp (working copy)
@@ -853,7 +853,15 @@
return true;
Expand All @@ -146,13 +144,13 @@ Index: src/shared/stream.cpp
{
Index: src/vcpp/sauerbraten.vcxproj
===================================================================
--- src/vcpp/sauerbraten.vcxproj (revision 6490)
--- src/vcpp/sauerbraten.vcxproj (revision 6496)
+++ src/vcpp/sauerbraten.vcxproj (working copy)
@@ -1132,6 +1132,20 @@
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)2.obj</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)2.obj</ObjectFileName>
</ClCompile>
+ <ClCompile Include="..\fpsgame\p1xbraten_menus.cpp">
+ <ClCompile Include="..\fpsgame\p1xbraten_cfgs.cpp">
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cube.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">cube.h</PrecompiledHeaderFile>
+ <PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)cube.pch</PrecompiledHeaderOutputFile>
Expand Down
16 changes: 8 additions & 8 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ CLIENT_OBJS= \
fpsgame/fragmessages.o \
fpsgame/monster.o \
fpsgame/movable.o \
fpsgame/p1xbraten_menus.o \
fpsgame/p1xbraten_cfgs.o \
fpsgame/render.o \
fpsgame/scoreboard.o \
fpsgame/server.o \
Expand Down Expand Up @@ -529,13 +529,13 @@ fpsgame/movable.o: shared/ents.h shared/command.h shared/glexts.h
fpsgame/movable.o: shared/glemu.h shared/iengine.h shared/igame.h
fpsgame/movable.o: shared/authservers.h fpsgame/ai.h
fpsgame/movable.o: fpsgame/weaponstats_type.h fpsgame/fragmessages.h
fpsgame/p1xbraten_menus.o: shared/cube.h shared/tools.h shared/geom.h
fpsgame/p1xbraten_menus.o: shared/ents.h shared/command.h shared/glexts.h
fpsgame/p1xbraten_menus.o: shared/glemu.h shared/iengine.h shared/igame.h
fpsgame/p1xbraten_menus.o: shared/authservers.h fpsgame/p1xbraten_menus.h
fpsgame/p1xbraten_menus.o: ../data/p1xbraten/menus.cfg.gz.xxd
fpsgame/p1xbraten_menus.o: ../data/p1xbraten/master.cfg.gz.xxd
fpsgame/p1xbraten_menus.o: ../data/p1xbraten/gamehud.cfg.gz.xxd
fpsgame/p1xbraten_cfgs.o: shared/cube.h shared/tools.h shared/geom.h
fpsgame/p1xbraten_cfgs.o: shared/ents.h shared/command.h shared/glexts.h
fpsgame/p1xbraten_cfgs.o: shared/glemu.h shared/iengine.h shared/igame.h
fpsgame/p1xbraten_cfgs.o: shared/authservers.h fpsgame/p1xbraten_cfgs.h
fpsgame/p1xbraten_cfgs.o: ../data/p1xbraten/menus.cfg.gz.xxd
fpsgame/p1xbraten_cfgs.o: ../data/p1xbraten/master.cfg.gz.xxd
fpsgame/p1xbraten_cfgs.o: ../data/p1xbraten/gamehud.cfg.gz.xxd
fpsgame/render.o: fpsgame/game.h shared/cube.h shared/tools.h shared/geom.h
fpsgame/render.o: shared/ents.h shared/command.h shared/glexts.h
fpsgame/render.o: shared/glemu.h shared/iengine.h shared/igame.h
Expand Down
1 change: 1 addition & 0 deletions src/engine/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,7 @@ int main(int argc, char **argv)
defformatstring(gamecfgname, "data/game_%s.cfg", game::gameident());
execfile(gamecfgname);
if(game::savedservers()) execfile(game::savedservers(), false);
game::writep1xbratencfgs();

identflags |= IDF_PERSIST;

Expand Down
19 changes: 3 additions & 16 deletions src/fpsgame/p1xbraten_menus.cpp → src/fpsgame/p1xbraten_cfgs.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "cube.h"
#include "p1xbraten_menus.h"
#include "p1xbraten_cfgs.h"

namespace game {
struct embeddedfile<16060> menuscfg = {
Expand Down Expand Up @@ -45,17 +45,8 @@ namespace game {
return 0;
}

extern int usep1xbratenmenus;

void executep1xbratenmenufiles()
{
if(usep1xbratenmenus) execfile(menuscfg.name);
}

int writep1xbratenmenufiles()
int writep1xbratencfgs()
{
if(!usep1xbratenmenus) return 1;

int err = update(&menuscfg);
if(err) { conoutf("\f6error updating %s (error code %d)!", menuscfg.name, err); return err; }

Expand All @@ -69,11 +60,7 @@ namespace game {
}

VARFP(usep1xbratenmenus, 0, 1, 1, {
if(usep1xbratenmenus)
{
writep1xbratenmenufiles();
executep1xbratenmenufiles();
}
if(usep1xbratenmenus) execfile(menuscfg.name);
else execfile("data/menus.cfg");
});
}
File renamed without changes.
3 changes: 1 addition & 2 deletions src/shared/igame.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ namespace game
extern const char *autoexec();
extern const char *savedservers();
extern void loadconfigs();
extern int writep1xbratenmenufiles();
extern void executep1xbratenmenufiles();
extern int writep1xbratencfgs();

extern void updateworld();
extern void initclient();
Expand Down
2 changes: 1 addition & 1 deletion src/vcpp/sauerbraten.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)2.obj</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Filename)2.obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\fpsgame\p1xbraten_menus.cpp">
<ClCompile Include="..\fpsgame\p1xbraten_cfgs.cpp">
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cube.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">cube.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)cube.pch</PrecompiledHeaderOutputFile>
Expand Down

0 comments on commit e5b1ef1

Please sign in to comment.