Browse Source

improve versioning system

master
Alison Watson 3 months ago
parent
commit
f0940dc730
4 changed files with 45 additions and 45 deletions
  1. +24
    -29
      source/include/m_version.h
  2. +0
    -1
      source/include/w_world.h
  3. +1
    -1
      source/p_data.c
  4. +20
    -14
      source/w_world.c

+ 24
- 29
source/include/m_version.h View File

@@ -11,34 +11,29 @@
* ---------------------------------------------------------------------------|
*/

#define Version "Lithium 1.7 (Yttrium Oxide)"
#define APIVersion v1_7_0
#define CheckAPIVersion() \
if(apiversion != APIVersion) { \
ACS_BeginLog(); \
__nprintf(c"%s: Invalid API version! Expected %i, but got %i\n", \
__func__, APIVersion, apiversion); \
ACS_EndLog(); \
abort(); \
} else (void)0
#include <stdio.h>
#define v1_7_0 17.0 /* 1.7 (Yttrium Oxide) */
#define v1_6_3 16.3 /* 1.6.3 (Trilithionite Red) */
#define v1_6_2 16.2 /* 1.6.2 (Trilithionite) */
#define v1_6_1 16.1 /* 1.6.1 (Hyper-Trilithium) */
#define v1_6_0 16.0 /* 1.6 (Hyper-Dilithium) */
#define v1_5_3 15.3 /* 1.5.3 (Indicolite Pegmatite) */
#define v1_5_2 15.2 /* 1.5.2 (Rubellite Pegmatite) */
#define v1_5_1 15.1 /* 1.5.1 (Rubellite Pegmatite) */
#define v1_5_0 15.04 /* 1.5 (Pegmatite) */
#define v1_5_0b 15.03 /* 1.5 Beta (Pegmatite) */
#define v1_5_0a2 15.02 /* 1.5 Alpha 2 (Pegmatite) */
#define v1_5_0a 15.01 /* 1.5 Alpha (Pegmatite) */
#define v1_4_0 14.0 /* 1.4 (Lumate) */
#define v1_3_1 13.1 /* 1.3.1 (LITHIUM - Hell Knights Insist On Dying) */
#define v1_3_0 13.0 /* 1.3 (Zabuyelite) */
#define v1_2_0 12.0 /* 1.2 (Lithium Carbonate) */
#define v1_1_0 11.0 /* 1.1 (Lithium Chloride) */
#define v1_0_0 10.0 /* 1.0 (Lithium) */
#define MakeVer(major, minor, patch, build) \
(major * 1000000 + \
minor * 10000 + \
patch * 100 + \
build)
#define VersionName "Lithium 1.7 (Yttrium Oxide)"
#define Ver1_0_0 10.0k /* Lithium */
#define Ver1_1_0 11.0k /* Lithium Chloride */
#define Ver1_2_0 12.0k /* Lithium Carbonate */
#define Ver1_3_0 13.0k /* Zabuyelite */
#define Ver1_3_1 13.1k /* LITHIUM - Hell Knights Insist On Dying */
#define Ver1_4_0 14.0k /* Lumate */
#define Ver1_5_0a 15.01k /* Pegmatite */
#define Ver1_5_0a2 15.02k /* Pegmatite */
#define Ver1_5_0b 15.03k /* Pegmatite */
#define Ver1_5_0 15.04k /* Pegmatite */
#define Ver1_5_1 15.1k /* Rubellite Pegmatite */
#define Ver1_5_2 15.2k /* Rubellite Pegmatite */
#define Ver1_5_3 15.3k /* Indicolite Pegmatite */
#define Ver1_6_0 16.0k /* Hyper-Dilithium */
#define Ver1_6_1 16.1k /* Hyper-Trilithium */
#define Ver1_6_2 16.2k /* Trilithionite */
#define Ver1_6_3 16.3k /* Trilithionite Red */
#define Ver1_7_0 MakeVer(1, 7, 0, 0) /* Yttrium Oxide */

/* EOF */

+ 0
- 1
source/include/w_world.h View File

@@ -192,7 +192,6 @@ extern bool lmvar islithmap;
extern i32 secretsfound;
extern k64 scoremul;
extern u64 ticks;
extern k32 apiversion;
extern i32 soulsfreed;
extern bool bossspawned;
extern i32 cbiperf;


+ 1
- 1
source/p_data.c View File

@@ -337,7 +337,7 @@ script void P_Init(struct player *p) {
if(!p->invinit) P_Inv_PInit(p);

if(!p->wasinit) {
p->logB(1, Version " :: Compiled %s", __DATE__);
p->logB(1, VersionName " :: Compiled " __DATE__);

#ifndef NDEBUG
if(dbglevel) {


+ 20
- 14
source/w_world.c View File

@@ -33,7 +33,6 @@ bool lmvar islithmap;
i32 secretsfound;
k64 scoremul;
u64 ticks;
k32 apiversion = APIVersion;
i32 soulsfreed;
bool bossspawned;
i32 cbiperf;
@@ -101,42 +100,49 @@ static void CheckModCompat(void)
drlamonsters = ACS_GetCVar(sc_drla_is_using_monsters);
}

static bool updateTo(k32 to) {
k32 cur = ACS_GetCVarFixed(sc_version);
if(cur < to) {
ACS_SetCVarFixed(sc_version, to);
return true;
} else {
return false;
}
}

static void UpdateGame(void)
{
#define Update(n) \
if(ACS_GetCVarFixed(sc_version) < n) \
__with(ACS_SetCVarFixed(sc_version, n);)

Update(v1_5_1)
if(updateTo(Ver1_5_1)) {
ACS_SetCVarFixed(sc_sv_scoremul, 1.25); /* 2.0 => 1.25 */
}

Update(v1_5_2)
if(updateTo(Ver1_5_2)) {
ACS_SetCVar(sc_sv_difficulty, 10); /* 1 => 10 */
}

Update(v1_6_0) {
if(updateTo(Ver1_6_0)) {
for_player() {
p->setCVarK(sc_player_footstepvol, 0.2); /* 1.0 => 0.2 */
p->setCVarI(sc_player_ammolog, true); /* false => true */
}
}

Update(v1_6_1) {
if(updateTo(Ver1_6_1)) {
for_player() {
p->setCVarK(sc_weapons_zoomfactor, 1.5); /* 3.0 => 1.5 */
}
}

/* unfortunate, but we forgot to add this for 1.6.3. so, we'll fix it in
* version 1.7 instead.
*/
Update(v1_7_0) {
if(updateTo(Ver1_7_0)) {
/* unfortunate, but we forgot to add this for 1.6.3. so, we'll fix it in
* version 1.7 instead.
*/
for_player() {
if(p->getCVarI(sc_xhair_style) >= 10) {
p->setCVarI(sc_xhair_style, 0);
}
}
}
#undef Update
}

static void MInitPre(void)


Loading…
Cancel
Save