From e5b1ef1a3a65a1643f0ad8b0bd2b40c59161d962 Mon Sep 17 00:00:00 2001 From: sauerbraten Date: Mon, 12 Apr 2021 10:19:56 +0200 Subject: [PATCH] include_p1xbraten_menus -> include_p1xbraten_cfgs --- Makefile | 14 ++--- ...nus.patch => include_p1xbraten_cfgs.patch} | 62 +++++++++---------- src/Makefile | 16 ++--- src/engine/main.cpp | 1 + ...p1xbraten_menus.cpp => p1xbraten_cfgs.cpp} | 19 +----- .../{p1xbraten_menus.h => p1xbraten_cfgs.h} | 0 src/shared/igame.h | 3 +- src/vcpp/sauerbraten.vcxproj | 2 +- 8 files changed, 51 insertions(+), 66 deletions(-) rename patches/{include_p1xbraten_menus.patch => include_p1xbraten_cfgs.patch} (83%) rename src/fpsgame/{p1xbraten_menus.cpp => p1xbraten_cfgs.cpp} (83%) rename src/fpsgame/{p1xbraten_menus.h => p1xbraten_cfgs.h} (100%) diff --git a/Makefile b/Makefile index 0a2a43c..a495c3f 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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) && \ diff --git a/patches/include_p1xbraten_menus.patch b/patches/include_p1xbraten_cfgs.patch similarity index 83% rename from patches/include_p1xbraten_menus.patch rename to patches/include_p1xbraten_cfgs.patch index fe36ce0..1522c9a 100644 --- a/patches/include_p1xbraten_menus.patch +++ b/patches/include_p1xbraten_cfgs.patch @@ -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 = { @@ -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; } + @@ -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" + @@ -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; @@ -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 @@ $(IntDir)%(Filename)2.obj $(IntDir)%(Filename)2.obj -+ ++ + cube.h + cube.h + $(IntDir)cube.pch diff --git a/src/Makefile b/src/Makefile index c25f36b..240b517 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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 \ @@ -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 diff --git a/src/engine/main.cpp b/src/engine/main.cpp index 02832d3..934686a 100644 --- a/src/engine/main.cpp +++ b/src/engine/main.cpp @@ -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; diff --git a/src/fpsgame/p1xbraten_menus.cpp b/src/fpsgame/p1xbraten_cfgs.cpp similarity index 83% rename from src/fpsgame/p1xbraten_menus.cpp rename to src/fpsgame/p1xbraten_cfgs.cpp index 498d6e9..5b423de 100644 --- a/src/fpsgame/p1xbraten_menus.cpp +++ b/src/fpsgame/p1xbraten_cfgs.cpp @@ -1,5 +1,5 @@ #include "cube.h" -#include "p1xbraten_menus.h" +#include "p1xbraten_cfgs.h" namespace game { struct embeddedfile<16060> menuscfg = { @@ -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; } @@ -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"); }); } diff --git a/src/fpsgame/p1xbraten_menus.h b/src/fpsgame/p1xbraten_cfgs.h similarity index 100% rename from src/fpsgame/p1xbraten_menus.h rename to src/fpsgame/p1xbraten_cfgs.h diff --git a/src/shared/igame.h b/src/shared/igame.h index fcc677e..af5ffac 100644 --- a/src/shared/igame.h +++ b/src/shared/igame.h @@ -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(); diff --git a/src/vcpp/sauerbraten.vcxproj b/src/vcpp/sauerbraten.vcxproj index f9f9364..658db51 100644 --- a/src/vcpp/sauerbraten.vcxproj +++ b/src/vcpp/sauerbraten.vcxproj @@ -1155,7 +1155,7 @@ $(IntDir)%(Filename)2.obj $(IntDir)%(Filename)2.obj - + cube.h cube.h $(IntDir)cube.pch