From e6ebe0f0c0d9f8ba0bf884c9a658724e45bc3a3c Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 2 Mar 2023 19:39:21 +0000 Subject: [PATCH] Allow demo assets map to be played only register appropriate weapon models if playing the demo map --- Projects/Android/AndroidManifest.xml | 4 +-- .../jni/OpenJK/codeJK2/cgame/cg_main.cpp | 28 +++++++++++++++++-- .../jni/OpenJK/codeJK2/cgame/cg_weapons.cpp | 18 ++---------- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/Projects/Android/AndroidManifest.xml b/Projects/Android/AndroidManifest.xml index 44afd31..ebf0092 100644 --- a/Projects/Android/AndroidManifest.xml +++ b/Projects/Android/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="39" + android:versionName="0.6.2" android:installLocation="auto" > diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp index e5df2ac..788136f 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp @@ -1511,10 +1511,34 @@ Ghoul2 Insert End CG_NewClientinfo( i ); } + const char *info = CG_ConfigString( CS_SERVERINFO ); + const char *mapname = Info_ValueForKey( info, "mapname" ); + bool isDemoMap = !strcmp(mapname,"demo"); + //Just register all weapons to avoid a pause when opening the selector - for (i=0; i < WP_MELEE; i++) + for (i=0; i <= WP_MELEE; i++) { - CG_RegisterWeapon(i); + //Only certain weapon models available in the demo pk3 + if (isDemoMap) + { + if (i == WP_SABER || + i == WP_BRYAR_PISTOL || + i == WP_BLASTER || + i == WP_FLECHETTE || + i == WP_REPEATER || + i == WP_THERMAL) + { + CG_RegisterWeapon(i); + } + else + { + continue; + } + } + else + { + CG_RegisterWeapon(i); + } } for (i=0 ; i < ENTITYNUM_WORLD ; i++) diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp index 61f8656..3cc3e46 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp @@ -3013,6 +3013,9 @@ void CG_DrawItemSelector( void ) } } + const char *info = CG_ConfigString( CS_SERVERINFO ); + const char *mapname = Info_ValueForKey( info, "mapname" ); + qboolean selected = qfalse; for (int index = 0; index < count; ++index) { @@ -3029,21 +3032,6 @@ void CG_DrawItemSelector( void ) { break; } - -#ifdef _DEMO - if (itemId == WP_SABER || - itemId == WP_BRYAR_PISTOL || - itemId == WP_BLASTER || - itemId == WP_FLECHETTE || - itemId == WP_REPEATER || - itemId == WP_THERMAL) { - CG_RegisterWeapon(itemId); - } else { - continue; - } -#else - CG_RegisterWeapon(itemId); -#endif } }