Browse Source

bunch of optimizations and shit

tags/1.6.1
Alison Watson 2 years ago
parent
commit
d60e7a100d
100 changed files with 515 additions and 381 deletions
  1. +1
    -0
      .gitignore
  2. BIN
      pk7/acs/lithlib.bin
  3. BIN
      pk7/acs/lithmain.bin
  4. +2
    -0
      pk7/lzscript/Constants/p_data.zsc
  5. +2
    -0
      pk7/lzscript/Constants/w_data.zsc
  6. +2
    -0
      pk7/lzscript/Constants/w_scorenums.zsc
  7. +2
    -2
      pk7/lzscript/Playsim/Events.zsc
  8. +2
    -0
      pk7_dt/dtzsc/pdata.zsc
  9. +2
    -0
      pk7_dt/dtzsc/wdata.zsc
  10. +24
    -6
      source/Headers/common.h
  11. +2
    -0
      source/Headers/dialogue.h
  12. +2
    -0
      source/Headers/dlgstab.h
  13. +2
    -0
      source/Headers/gui.h
  14. +3
    -1
      source/Headers/items.h
  15. +2
    -0
      source/Headers/m_char.h
  16. +2
    -0
      source/Headers/m_cps.h
  17. +2
    -0
      source/Headers/m_drawing.h
  18. +2
    -0
      source/Headers/m_file.h
  19. +2
    -0
      source/Headers/m_list.h
  20. +2
    -0
      source/Headers/m_math.h
  21. +2
    -0
      source/Headers/m_memory.h
  22. +2
    -0
      source/Headers/m_stab.h
  23. +3
    -1
      source/Headers/m_str.h
  24. +2
    -0
      source/Headers/m_tokbuf.h
  25. +2
    -0
      source/Headers/m_token.h
  26. +4
    -1
      source/Headers/m_types.h
  27. +2
    -0
      source/Headers/m_vec.h
  28. +2
    -0
      source/Headers/m_version.h
  29. +2
    -0
      source/Headers/p_attrib.h
  30. +2
    -0
      source/Headers/p_bip.h
  31. +2
    -0
      source/Headers/p_cbi.h
  32. +2
    -0
      source/Headers/p_data.h
  33. +2
    -0
      source/Headers/p_hud.h
  34. +2
    -0
      source/Headers/p_hudid.h
  35. +2
    -0
      source/Headers/p_log.h
  36. +3
    -0
      source/Headers/p_player.h
  37. +2
    -0
      source/Headers/p_savedata.h
  38. +2
    -0
      source/Headers/p_shopdef.h
  39. +10
    -0
      source/Headers/p_sys.h
  40. +2
    -0
      source/Headers/p_upgrades.h
  41. +2
    -0
      source/Headers/p_wepinfo.h
  42. +2
    -0
      source/Headers/u_common.h
  43. +2
    -0
      source/Headers/u_data.h
  44. +2
    -0
      source/Headers/u_func_beg.h
  45. +2
    -0
      source/Headers/u_func_end.h
  46. +2
    -0
      source/Headers/w_data.h
  47. +2
    -0
      source/Headers/w_monster.h
  48. +2
    -0
      source/Headers/w_scorenums.h
  49. +3
    -11
      source/Headers/w_world.h
  50. +4
    -2
      source/Main/dialogue_compiler.c
  51. +5
    -3
      source/Main/dialogue_vm.c
  52. +2
    -0
      source/Main/g_auto.c
  53. +2
    -0
      source/Main/g_button.c
  54. +2
    -0
      source/Main/g_checkbox.c
  55. +2
    -0
      source/Main/g_preset.c
  56. +2
    -0
      source/Main/g_scrollbar.c
  57. +2
    -0
      source/Main/g_slider.c
  58. +2
    -0
      source/Main/g_textbox.c
  59. +0
    -141
      source/Main/m_common.c
  60. +0
    -19
      source/Main/m_cps.c
  61. +93
    -0
      source/Main/m_debug.c
  62. +2
    -0
      source/Main/m_draw.c
  63. +4
    -2
      source/Main/m_file.c
  64. +2
    -0
      source/Main/m_list.c
  65. +2
    -0
      source/Main/m_math.c
  66. +2
    -0
      source/Main/m_namegen.c
  67. +0
    -44
      source/Main/m_print.c
  68. +19
    -3
      source/Main/m_str.c
  69. +2
    -0
      source/Main/m_tokbuf.c
  70. +2
    -0
      source/Main/m_token.c
  71. +6
    -4
      source/Main/p_bip.c
  72. +3
    -1
      source/Main/p_cbi.c
  73. +16
    -17
      source/Main/p_data.c
  74. +2
    -0
      source/Main/p_gui_bip.c
  75. +2
    -0
      source/Main/p_gui_cbi.c
  76. +3
    -1
      source/Main/p_gui_upgrades.c
  77. +3
    -1
      source/Main/p_hud.c
  78. +8
    -6
      source/Main/p_items.c
  79. +4
    -2
      source/Main/p_log.c
  80. +55
    -0
      source/Main/p_m_dbg.c
  81. +7
    -5
      source/Main/p_magic.c
  82. +0
    -69
      source/Main/p_misc.c
  83. +2
    -0
      source/Main/p_notes.c
  84. +3
    -1
      source/Main/p_obituary.c
  85. +5
    -3
      source/Main/p_payout.c
  86. +2
    -0
      source/Main/p_pickups.c
  87. +24
    -3
      source/Main/p_player.c
  88. +45
    -8
      source/Main/p_powerup.c
  89. +3
    -2
      source/Main/p_render.c
  90. +3
    -1
      source/Main/p_save.c
  91. +6
    -4
      source/Main/p_savedata.c
  92. +2
    -0
      source/Main/p_settings.c
  93. +4
    -2
      source/Main/p_shop.c
  94. +2
    -0
      source/Main/p_shopdef.c
  95. +2
    -0
      source/Main/p_statistics.c
  96. +2
    -0
      source/Main/p_status.c
  97. +5
    -5
      source/Main/p_upgrades.c
  98. +12
    -10
      source/Main/p_weapons.c
  99. +2
    -0
      source/Main/u_7777777.c
  100. +2
    -0
      source/Main/u_adrenaline.c

+ 1
- 0
.gitignore View File

@@ -1,5 +1,6 @@
working/*
ir/**/*.ir
ir/*_ld.txt
compile.bat
*.kdev4
*.dbs


BIN
pk7/acs/lithlib.bin View File


BIN
pk7/acs/lithmain.bin View File


+ 2
- 0
pk7/lzscript/Constants/p_data.zsc View File

@@ -5,6 +5,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_data.h: Exposed player data.

enum PData
{
pdata_weapon,


+ 2
- 0
pk7/lzscript/Constants/w_data.zsc View File

@@ -5,6 +5,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// w_data.h: Exposed world data.

enum WData
{
wdata_bossspawned,


+ 2
- 0
pk7/lzscript/Constants/w_scorenums.zsc View File

@@ -5,6 +5,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// w_scorenums.h: Score numbers for various items and enemies.

enum ScoreNum
{
// Score values


+ 2
- 2
pk7/lzscript/Playsim/Events.zsc View File

@@ -25,8 +25,8 @@ override void WorldLoaded(WorldEvent ev)
CallACS("Lith_WorldReopen");
else
{
CallACS("__lithlib.bin_init");
CallACS("__lithmain.bin_init");
CallACS("lithlib@gsinit");
CallACS("lithmain@gsinit");

let sum = Level.GetChecksum();
for(int i = 0; i < BOSSLEVELS.Size(); i++)


+ 2
- 0
pk7_dt/dtzsc/pdata.zsc View File

@@ -5,6 +5,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_data.h: Exposed player data.

enum PData
{
pdata_weapon,


+ 2
- 0
pk7_dt/dtzsc/wdata.zsc View File

@@ -5,6 +5,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// w_data.h: Exposed world data.

enum WData
{
wdata_bossspawned,


+ 24
- 6
source/Headers/common.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// common.h: Common functions and debugging functions.

#ifndef common_h
#define common_h

@@ -29,10 +31,12 @@
#define IsSmallNumber(x) ((x) > -0.001 && (x) < 0.001)
#define CloseEnough(x, y) (IsSmallNumber(x - y))

#ifndef NDEBUG
#define LogDebug(level, ...) \
do if(ACS_GetCVar(sc_debug_level) & (level)) \
Log(c"" #level ": " __VA_ARGS__); \
while(0)
do if(dbglevel & (level)) Log(c"" #level ": " __VA_ARGS__); while(0)
#else
#define LogDebug(...)
#endif

#define TickerT(t, on, off) ((ACS_Timer() % 35) < (t) ? (on) : (off))
#define Ticker(on, off) (TickerT(17, on, off))
@@ -97,10 +101,10 @@
#define DrawCallS(...) SCallS(sm_Draw, __VA_ARGS__)

#define DebugStat(...) \
(world.dbgLevel & log_devh ? Lith_DebugStat(__VA_ARGS__) : (void)0)
(dbglevel & log_devh ? Lith_DebugStat(__VA_ARGS__) : (void)0)

#define DebugNote(...) \
(world.dbgLevel & log_devh ? Lith_DebugNote(__VA_ARGS__) : (void)0)
(dbglevel & log_devh ? Lith_DebugNote(__VA_ARGS__) : (void)0)

#define InvNum ACS_CheckInventory
#define InvMax(arg) ACS_GetMaxInventory(0, arg)
@@ -121,6 +125,17 @@ enum {
log_dmonV = 1 << 4, // verbose debug info for the monster tracker
log_dlg = 1 << 5, // debug info for the dialogue/terminal compiler
log_bip = 1 << 6, // debug info for the BIP
log_sys = 1 << 7, // meta debug info
log_sysV = 1 << 7, // tick info
};

enum {
dbgf_bip = 1 << 0,
dbgf_items = 1 << 1,
dbgf_nomon = 1 << 2,
dbgf_save = 1 << 3,
dbgf_score = 1 << 4,
dbgf_upgr = 1 << 5,
};

// Extern Functions ----------------------------------------------------------|
@@ -144,11 +159,14 @@ void Lith_DebugNote(char const *fmt, ...);
// Address Space Definitions -------------------------------------------------|

__addrdef extern __mod_arr lmvar;
__addrdef extern __hub_arr lwvar;
__addrdef extern __hub_arr lhvar;

// Extern Objects ------------------------------------------------------------|

extern str dbgstat[], dbgnote[];
extern i32 dbgstatnum, dbgnotenum;

extern i32 lmvar dbglevel;
extern i32 lmvar dbgflag;

#endif

+ 2
- 0
source/Headers/dialogue.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// dialogue.h: Dialogue VM code data.

#ifdef DCD
// VM state
DCD(NOP)


+ 2
- 0
source/Headers/dlgstab.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// dlgstab.h: Dialogue string table.

Str(NULL, "")
Str(class, "class")
Str(dialogue, "dialogue")


+ 2
- 0
source/Headers/gui.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// gui.h: GUI functions and data.

#ifndef gui_h
#define gui_h



+ 3
- 1
source/Headers/items.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// items.h: Inventory items.

#ifndef items_h
#define items_h

@@ -14,7 +16,7 @@ struct itemdata
i96 scr;

// these need to be ScriptS or they'll disappear on map load
// (we can't use a GSReinit callback because that would be really bad)
// (we shouldn't use a MInit callback because it would cause too much recursion)
script bool (*Use)(struct item *);
script void (*Tick)(struct item *);
script void (*Destroy)(struct item *);


+ 2
- 0
source/Headers/m_char.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_char.h: ASCII character classification macros.

#define IsGraph(ch) ((ch) > ' ' && (ch) <= '~')
#define IsPrint(ch) ((ch) >= ' ' && (ch) <= '~')
#define IsPunct(ch) ((ch) >= '!' && (ch) <= '/' || \


+ 2
- 0
source/Headers/m_cps.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_cps.h: Compressed strings.

#ifndef m_cps_h
#define m_cps_h



+ 2
- 0
source/Headers/m_drawing.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_drawing.h: Drawing functions.

// Not 1.0 / 35.0 or even 0.028 because ZDoom is stupid.
#define TS 0.029



+ 2
- 0
source/Headers/m_file.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_file.h: I/O stream handling.

#ifndef m_file_h
#define m_file_h



+ 2
- 0
source/Headers/m_list.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_list.h: Linked lists.

#ifndef m_list_h
#define m_list_h



+ 2
- 0
source/Headers/m_math.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_math.h: Math functions.

#define max(x, y) ((x) < (y) ? (y) : (x))
#define min(x, y) ((x) < (y) ? (x) : (y))
#define minmax(x, mi, ma) (min(max(x, mi), ma))


+ 2
- 0
source/Headers/m_memory.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_memory.h: Memory allocation functions.

#ifndef m_memory_h
#define m_memory_h



+ 2
- 0
source/Headers/m_stab.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_stab.h: ACS string table.

#if defined(X)

// Strings


+ 3
- 1
source/Headers/m_str.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_str.h: Various string functions.

#include <GDCC.h>
#include <stdio.h>

@@ -24,7 +26,7 @@ stkcall u32 l_strhash(char __str_ars const *s);
stkcall u32 lstrhash(char const *s);
char *lstrcpy_str(char *dest, char __str_ars const *src);
i32 lstrcmp_str(char const *s1, char __str_ars const *s2);
stkcall str scoresep(i96 num);
stkcall char const *scoresep(i96 num);
str LanguageV(str name);
str LanguageNull(char const *fmt, ...);
char *LanguageVC(char *out, char const *name);


+ 2
- 0
source/Headers/m_tokbuf.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_tokbuf.h: Buffered token stream.

#ifndef m_tokbuf_h
#define m_tokbuf_h



+ 2
- 0
source/Headers/m_token.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_token.h: Token-based text parsing.

#ifndef m_token_h
#define m_token_h



+ 4
- 1
source/Headers/m_types.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_types.h: Common type definitions and attribute macros.

#ifndef m_types_h
#define m_types_h

@@ -13,7 +15,8 @@
#define nil NULL

#define stkcall [[__call("StkCall")]]
#define script [[__call("ScriptS")]]
#define script [[__call("ScriptI")]]
#define script_str [[__call("ScriptS")]]
#define optargs(x) [[__optional_args(x)]]
#define noinit [[__no_init]]
#define anonymous [[__anonymous]]


+ 2
- 0
source/Headers/m_vec.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_vec.h: Dynamically allocated arrays.

#ifndef m_vec_h
#define m_vec_h



+ 2
- 0
source/Headers/m_version.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_version.h: Version numbers and current version.

#if LITHIUM
#define Lith_Version "Lithium 1.6.1 (Hyper-Trilithium)"
#else


+ 2
- 0
source/Headers/p_attrib.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_attrib.h: Player attributes.

#ifndef p_attrib_h
#define p_attrib_h



+ 2
- 0
source/Headers/p_bip.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_bip.h: Info page data.

#if defined(LITH_X)
LITH_X(WEAPONS, "Weapons")
LITH_X(ENEMIES, "Adversaries")


+ 2
- 0
source/Headers/p_cbi.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_cbi.h: CBI GUI data.

#ifndef p_cbi_h
#define p_cbi_h



+ 2
- 0
source/Headers/p_data.h View File

@@ -5,6 +5,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_data.h: Exposed player data.

enum // PData
{
pdata_weapon,


+ 2
- 0
source/Headers/p_hud.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_hud.h: Generalized HUD functions.

#ifndef p_hud_h
#define p_hud_h



+ 2
- 0
source/Headers/p_hudid.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_hudid.h: Legacy HudMessage IDs and new Fade IDs.

#ifndef p_hudid_h
#define p_hudid_h



+ 2
- 0
source/Headers/p_log.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_log.h: Action logging functions.

#ifndef p_log_h
#define p_log_h



+ 3
- 0
source/Headers/p_player.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_player.h: Player data and functions.

#if defined(LITH_X)
// Shorthand and classes. For parsing and headers.
LITH_X(pM, pcl_marine)
@@ -34,6 +36,7 @@ LITH_X(gR, pcl_robot)
#include "p_wepinfo.h"
#include "p_shopdef.h"
#include "p_attrib.h"
#include "p_sys.h"
#include "items.h"

#include <GDCC/HashMap.h>


+ 2
- 0
source/Headers/p_savedata.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_savedata.h: Save file format.

#ifndef p_savedata_h
#define p_savedata_h



+ 2
- 0
source/Headers/p_shopdef.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_shopdef.h: Unified shop definitions.

#ifndef p_shopdef_h
#define p_shopdef_h



+ 10
- 0
source/Headers/p_sys.h View File

@@ -0,0 +1,10 @@
// Distributed under the CC0 public domain license.
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_sys.h: Player modules.

#ifndef p_sys_h
#define p_sys_h

#endif

+ 2
- 0
source/Headers/p_upgrades.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_upgrades.h: Upgrade entry points and utilities.

#ifndef p_upgrades_h
#define p_upgrades_h



+ 2
- 0
source/Headers/p_wepinfo.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_wepinfo.h: Weapon tracking information.

#ifndef p_wepinfo_h
#define p_wepinfo_h



+ 2
- 0
source/Headers/u_common.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// u_common.h: Headers used throughout upgrade code.

#include "common.h"
#include "p_player.h"
#include "p_hudid.h"

+ 2
- 0
source/Headers/u_data.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// u_data.h: Upgrade data and handling functions.

#ifndef u_data_h
#define u_data_h



+ 2
- 0
source/Headers/u_func_beg.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// u_func_beg.h: Opening segment of u_func.h.

#ifdef Ret
#define Case(n) Ret(n) case UPGR_##n:;
#define A(n) Fn_F(n, Activate)


+ 2
- 0
source/Headers/u_func_end.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// u_func_end.h: Exiting segment of u_func.h.

#undef Ret
#undef Fn_F
#undef Fn_S


+ 2
- 0
source/Headers/w_data.h View File

@@ -5,6 +5,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// w_data.h: Exposed world data.

enum // WData
{
wdata_bossspawned,


+ 2
- 0
source/Headers/w_monster.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// w_monster.h: Monster tracking and information.

#ifndef w_monster_h
#define w_monster_h



+ 2
- 0
source/Headers/w_scorenums.h View File

@@ -4,6 +4,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// w_scorenums.h: Score numbers for various items and enemies.

enum // ScoreNum
{
// Score values


+ 3
- 11
source/Headers/w_world.h View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// w_world.h: World data.

#ifndef w_world_h
#define w_world_h

@@ -81,7 +83,6 @@ struct worldinfo
__prop freeze {call: Lith_FreezeTime()}
__prop autosave {get: ACS_GetCVar(sc_sv_autosave)}

bool gsinit;
bool singleplayer;
i32 mapscleared;
i32 prevcluster;
@@ -118,18 +119,9 @@ struct worldinfo
struct polar a_angles[8];
i32 a_cur;
i32 decvars[8];

// Debugging
i32 dbgLevel;
bool dbgItems;
bool dbgBIP;
bool dbgScore;
bool dbgUpgr;
bool dbgSave;
bool dbgNoMon;
};

extern bool lmvar mapinit;
extern bool lmvar player_init;
extern struct worldinfo world;
extern struct payoutinfo payout;



source/Main/w_dialogue.c → source/Main/dialogue_compiler.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// dialogue_compiler.c: Dialogue code compiler.

#if LITHIUM
#include "common.h"
#include "w_world.h"
@@ -468,7 +470,7 @@ static void GetDecl_TrmPage(struct pstate *d, i32 num)

// Loads all string indices into the global stbl, and all function
// prototypes into the global ftbl.
void Lith_GSInit_Dialogue(void)
void Lith_GInit_Dialogue(void)
{
static struct dlgfunc funcs[] = {
{"nop", "L", DCD_NOP},
@@ -588,7 +590,7 @@ done:
d.tb.dtor();
fclose(d.tb.fp);

if(world.dbgLevel & log_dlg)
if(dbglevel & log_dlg)
{
static char const *dcdnames[] = {
#define DCD(name) #name,

source/Main/p_dialogue.c → source/Main/dialogue_vm.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// dialogue_vm.c: Main dialogue VM.

#if LITHIUM
#include "common.h"
#include "w_world.h"
@@ -285,7 +287,7 @@ static void ResetText(struct vm *vm)

// Extern Functions ----------------------------------------------------------|

script ext("ACS")
script_str ext("ACS")
void Lith_TeleportOutEffect(struct player *p)
{
if(!p) p = LocalPlayer;
@@ -520,7 +522,7 @@ done:
p->indialogue -= 2;
}

script ext("ACS")
script_str ext("ACS")
void Lith_RunDialogue(i32 num)
{
withplayer(LocalPlayer) if(!p->indialogue)
@@ -530,7 +532,7 @@ void Lith_RunDialogue(i32 num)
}
}

script ext("ACS")
script_str ext("ACS")
void Lith_RunTerminal(i32 num)
{
Lith_RunDialogue(-num);

+ 2
- 0
source/Main/g_auto.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// g_auto.c: Miscellaneous GUI functions.

#include "common.h"
#include "p_player.h"
#include "w_world.h"


+ 2
- 0
source/Main/g_button.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// g_button.c: GUI buttons.

#include "common.h"
#include "p_player.h"



+ 2
- 0
source/Main/g_checkbox.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// g_checkbox.c: GUI checkboxes.

#include "common.h"
#include "p_player.h"



+ 2
- 0
source/Main/g_preset.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// g_preset.c: GUI presets.

#include "common.h"
#include "p_player.h"



+ 2
- 0
source/Main/g_scrollbar.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// g_scrollbar.c: GUI scroll bars.

#include "common.h"
#include "p_player.h"



+ 2
- 0
source/Main/g_slider.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// g_slider.c: GUI sliders.

#include "common.h"
#include "p_player.h"



+ 2
- 0
source/Main/g_textbox.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// g_textbox.c: GUI text boxes.

#include "common.h"
#include "p_player.h"
#include "w_world.h"


+ 0
- 141
source/Main/m_common.c View File

@@ -1,141 +0,0 @@
// Distributed under the CC0 public domain license.
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

#include "common.h"
#include "p_player.h"
#include "w_world.h"

#include <stdio.h>
#include <GDCC.h>

// Extern Objects ------------------------------------------------------------|

str dbgstat[64], dbgnote[64];
i32 dbgstatnum, dbgnotenum;

// Static Functions ----------------------------------------------------------|

stkcall
static void SetInventory(str item, i32 amount)
{
i32 s = InvNum(item) - amount;
if(s < 0) InvTake(item, -s);
else if(s > 0) InvGive(item, s);
}

stkcall
static void SetActorInventory(i32 tid, str item, i32 amount)
{
i32 s = ACS_CheckActorInventory(tid, item) - amount;
if(s < 0) ACS_TakeActorInventory(tid, item, -s);
else if(s > 0) ACS_GiveActorInventory(tid, item, s);
}

// Extern Functions ----------------------------------------------------------|

script
void Lith_DumpAlloc(void)
{
__GDCC__alloc_dump();
}

stkcall
void Lith_FadeFlash(i32 r, i32 g, i32 b, k32 amount, k32 seconds)
{
ACS_FadeTo(r, g, b, amount, 0.0);
ACS_FadeTo(r, g, b, 0.0, seconds);
}

script
i32 Lith_GetTID(i32 tid, i32 ptr)
{
if(tid || ptr)
ACS_SetActivator(tid, ptr);
return ACS_ActivatorTID();
}

script
i32 Lith_GetPlayerNumber(i32 tid, i32 ptr)
{
if(tid || ptr)
ACS_SetActivator(tid, ptr);
return ACS_PlayerNumber();
}

script
bool Lith_ValidPointer(i32 tid, i32 ptr)
{
if(tid || ptr)
return ACS_SetActivator(tid, ptr);
else
return true;
}

script
bool Lith_SetPointer(i32 tid, i32 ptr, i32 assign, i32 tid2, i32 ptr2, i32 flags)
{
if(tid || ptr)
ACS_SetActivator(tid, ptr);
return ACS_SetPointer(assign, tid2, ptr2, flags);
}

stkcall
i32 Lith_CheckActorInventory(i32 tid, str item)
{
if(tid == 0) return InvNum(item);
else return ACS_CheckActorInventory(tid, item);
}

stkcall
void Lith_GiveActorInventory(i32 tid, str item, i32 amount)
{
if(tid == 0) InvGive(item, amount);
else ACS_GiveActorInventory(tid, item, amount);
}

stkcall
void Lith_TakeActorInventory(i32 tid, str item, i32 amount)
{
if(tid == 0) InvTake(item, amount);
else ACS_TakeActorInventory(tid, item, amount);
}

stkcall
void Lith_SetActorInventory(i32 tid, str item, i32 amount)
{
if(tid == 0) SetInventory(item, amount);
else SetActorInventory(tid, item, amount);
}

void Lith_DebugStat(char const *fmt, ...)
{
if(!(world.dbgLevel & log_devh)) return;

va_list vl;

ACS_BeginPrint();

va_start(vl, fmt);
__vnprintf(fmt, vl);
va_end(vl);

dbgstat[dbgstatnum++] = ACS_EndStrParam();
}

void Lith_DebugNote(char const *fmt, ...)
{
if(!(world.dbgLevel & log_devh)) return;

va_list vl;

ACS_BeginPrint();

va_start(vl, fmt);
__vnprintf(fmt, vl);
va_end(vl);

dbgnote[dbgnotenum++] = ACS_EndStrParam();
}

// EOF

+ 0
- 19
source/Main/m_cps.c View File

@@ -1,19 +0,0 @@
// Distributed under the CC0 public domain license.
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

#include "common.h"
#include "m_cps.h"

// Extern Functions ----------------------------------------------------------|

char const *Cps_Print(u32 *cps, i32 l)
{
noinit static char buf[4096];
i32 i, ch;
for(i = 0; (ch = Cps_GetC(cps, i)) && (!l || i < l); i++) buf[i] = ch;
buf[i] = '\0';
return buf;
}

// EOF

+ 93
- 0
source/Main/m_debug.c View File

@@ -0,0 +1,93 @@
// Distributed under the CC0 public domain license.
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_debug.c: Debugging functions.

#include "common.h"
#include "p_player.h"

#include <stdio.h>
#include <GDCC.h>

str dbgstat[64], dbgnote[64];
i32 dbgstatnum, dbgnotenum;

script_str ext("ACS")
void Lith_GiveMeAllOfTheScore(void)
{
withplayer(LocalPlayer) p->giveScore(0x7FFFFFFFFFFFFFFFFFFFFFFFLL, true);
}

script_str ext("ACS")
void Lith_DumpAlloc(void)
{
__GDCC__alloc_dump();
}

void Lith_DebugStat(char const *fmt, ...)
{
if(!(dbglevel & log_devh)) return;

va_list vl;

ACS_BeginPrint();

va_start(vl, fmt);
__vnprintf(fmt, vl);
va_end(vl);

dbgstat[dbgstatnum++] = ACS_EndStrParam();
}

void Lith_DebugNote(char const *fmt, ...)
{
if(!(dbglevel & log_devh)) return;

va_list vl;

ACS_BeginPrint();

va_start(vl, fmt);
__vnprintf(fmt, vl);
va_end(vl);

dbgnote[dbgnotenum++] = ACS_EndStrParam();
}

void Log(char const *fmt, ...)
{
va_list vl;

ACS_BeginPrint();

va_start(vl, fmt);
__vnprintf(fmt, vl);
va_end(vl);

ACS_EndLog();
}

script
void Lith_PrintMem(void const *data, size_t size)
{
byte const *d = data;
i32 pos = 0;

for(size_t i = 0; i < size; i++)
{
if(pos + 3 > 79)
{
puts("");
pos = 0;
}

printf(IsPrint(d[i]) ? "%c " : c"%.2X ", d[i]);

pos += 3;
}

puts("\nEOF\n\n");
}

// EOF

+ 2
- 0
source/Main/m_draw.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_draw.c: Legacy drawing functions.

#include "common.h"

#include <stdio.h>


+ 4
- 2
source/Main/m_file.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_file.c: I/O stream handling.

#define _GNU_SOURCE // Needed for fopencookie. See: man 7 feature_test_macros

#include "common.h"
@@ -37,7 +39,7 @@ static i32 NetClose(void *nfdata)
struct netfile *nf = nfdata;

// If debugging, print out information about the buffer being written.
if(world.dbgSave)
if(dbgflag & dbgf_save)
{
printf("NetClose: Writing netfile \"%S\" (%zub)\n", nf->pcvar, nf->pos);
printf("Data follows\n");
@@ -201,7 +203,7 @@ FILE *Lith_NFOpen(i32 pnum, str pcvar, char rw)
Dalloc(input);

// If debugging, print out information about the buffer being read.
if(world.dbgSave)
if(dbgflag & dbgf_save)
{
printf("Lith_NFOpen: Opening memfile \"%S\" (%zub)\n", pcvar, size);
printf("Data follows\n");


+ 2
- 0
source/Main/m_list.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_list.c: Linked list functions.

#include "m_list.h"
#include <stdlib.h>
#include <string.h>


+ 2
- 0
source/Main/m_math.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_math.c: Various math functions.

#include "common.h"

#include <math.h>


+ 2
- 0
source/Main/m_namegen.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_namegen.c: Procedural monster name generation.

// Predefined names and suffixes mostly taken from Kyle873's Doom RPG.
// Used with permission.
#include "common.h"


+ 0
- 44
source/Main/m_print.c View File

@@ -1,44 +0,0 @@
// Distributed under the CC0 public domain license.
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

#include "common.h"

#include <stdio.h>

void Log(char const *fmt, ...)
{
va_list vl;

ACS_BeginPrint();

va_start(vl, fmt);
__vnprintf(fmt, vl);
va_end(vl);

ACS_EndLog();
}

script
void Lith_PrintMem(void const *data, size_t size)
{
byte const *d = data;
i32 pos = 0;

for(size_t i = 0; i < size; i++)
{
if(pos + 3 > 79)
{
puts("");
pos = 0;
}

printf(IsPrint(d[i]) ? "%c " : c"%.2X ", d[i]);

pos += 3;
}

puts("\nEOF\n\n");
}

// EOF

+ 19
- 3
source/Main/m_str.c View File

@@ -2,7 +2,10 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_str.c: Various string functions.

#include "common.h"
#include "m_cps.h"

#include <stdio.h>
#include <ctype.h>
@@ -25,6 +28,15 @@ StrEntON
#include "m_stab.h"
StrEntOFF

char const *Cps_Print(u32 *cps, i32 l)
{
noinit static char buf[4096];
i32 i, ch;
for(i = 0; (ch = Cps_GetC(cps, i)) && (!l || i < l); i++) buf[i] = ch;
buf[i] = '\0';
return buf;
}

str l_strupper(str in)
{
ACS_BeginPrint();
@@ -63,11 +75,15 @@ i32 lstrcmp_str(char const *s1, char __str_ars const *s2)
}

stkcall
str scoresep(i96 num)
char const *scoresep(i96 num)
{
static char out[48];

if(!num) return st_0;
if(!num) {
out[0] = '0';
out[1] = '\0';
return out;
}

char *outp = out + countof(out) - 1;
i32 cnum = 0;
@@ -86,7 +102,7 @@ str scoresep(i96 num)

if(!cnum) outp++;

return l_strdup(outp);
return outp;
}

str LanguageV(str name)


+ 2
- 0
source/Main/m_tokbuf.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_tokbuf.c: Buffered token stream.

#include "m_tokbuf.h"

#include <string.h>


+ 2
- 0
source/Main/m_token.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// m_token.c: Token-based text parsing.

#include "m_token.h"
#include "m_vec.h"
#include "m_char.h"


+ 6
- 4
source/Main/p_bip.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_bip.c: Info page handling and loading.

#include "common.h"
#include "p_player.h"
#include "p_bip.h"
@@ -161,12 +163,12 @@ void Lith_PlayerInitBIP(struct player *p)
bip->infogr[categ].free(true);

i32 total = LoadBIPInfo(sp_lfiles_BIPInfo, bip, p->pclass);
if(world.dbgLevel) p->logH(1, "There are %i info pages!", total);
if(dbglevel) p->logH(1, "There are %i info pages!", total);

ForCategory()
bip->pagemax += bip->categorymax[categ] = bip->infogr[categ].size();

if(world.dbgBIP) ForCategoryAndPage() UnlockPage(bip, page, p->pclass);
if(dbgflag & dbgf_bip) ForCategoryAndPage() UnlockPage(bip, page, p->pclass);

bip->init = true;
}
@@ -257,7 +259,7 @@ struct page *Lith_UnlockBIPPage(struct bip *bip, char const *name, i32 pclass)
return page;
}

script ext("ACS")
script_str ext("ACS")
void Lith_BIPUnlock(i32 pnum)
{
withplayer(&players[pnum])
@@ -312,7 +314,7 @@ struct page_info Lith_GetPageInfo(struct page const *page)
return pinf;
}

script ext("ACS")
script_str ext("ACS")
void Lith_GiveMail(i32 num)
{
static str const names[] = {


source/Main/p_cbigui.c → source/Main/p_cbi.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_cbi.c: Main CBI GUI entry point.

#include "common.h"
#include "p_player.h"
#include "p_hudid.h"
@@ -156,7 +158,7 @@ void Lith_PlayerResetCBIGUI(struct player *p)

// Scripts -------------------------------------------------------------------|

script ext("ACS") type("net")
script_str ext("ACS") type("net")
void Lith_KeyOpenCBI(void)
{
if(ACS_Timer() < 10) return;

+ 16
- 17
source/Main/p_data.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_data.c: Player data tracking.

#include "common.h"
#include "p_player.h"
#include "m_version.h"
@@ -147,7 +149,7 @@ void Lith_PlayerUpdateData(struct player *p)
p->kbs = InvNum(so_BlueSkull);
}

script ext("ACS")
script_str ext("ACS")
void Lith_KeyDown(i32 pnum, i32 ch)
{
withplayer(&players[pnum])
@@ -226,18 +228,14 @@ void Lith_GiveEXP(struct player *p, u64 amt)
script
void Lith_ResetPlayer(struct player *p)
{
// Zero-init
if(!p->wasinit) memset(p, 0, sizeof *p);

// Constant data
p->active = true;
p->reinit = p->dead = false;
p->num = ACS_PlayerNumber();
p->bipptr = &p->bip;

// Static data (pre-init)
if(!p->wasinit)
{
memset(p, 0, sizeof *p);

p->active = true;
p->num = ACS_PlayerNumber();
p->bipptr = &p->bip;

SetPClass(p);
SetupAttributes(p);

@@ -255,12 +253,14 @@ void Lith_ResetPlayer(struct player *p)
case 2: p->pronoun = pro_nb; break;
case 3: p->pronoun = pro_object; break;
}

}

// Map-static data
memset(&p->old, 0, sizeof p->old);

// If the map sets the TID on the first tic, it could already be set here.
p->reinit = p->dead = false;

// If the map sets the TID early on, it could already be set here.
p->tid = 0;
p->validateTID();

@@ -269,7 +269,7 @@ void Lith_ResetPlayer(struct player *p)
ACS_SpawnForced(so_CameraHax, 0, 0, 0, p->cameratid = ACS_UniqueTID());
ACS_SpawnForced(so_CameraHax, 0, 0, 0, p->weathertid = ACS_UniqueTID());

if(world.dbgScore) p->score = 0xFFFFFFFFFFFFFFFFll;
if(dbgflag & dbgf_score) p->score = 0xFFFFFFFFFFFFFFFFll;

// Any linked lists on the player need to be initialized here.
p->hudstrlist.free(true);
@@ -312,12 +312,11 @@ void Lith_ResetPlayer(struct player *p)
if(!p->invinit) Lith_PlayerInitInventory(p);
#endif

// Static data
if(!p->wasinit)
{
p->logB(1, Lith_Version " :: Compiled %s", __DATE__);

if(world.dbgLevel) {
if(dbglevel) {
p->logH(1, "player is %u bytes long!", sizeof *p * 4);
p->logH(1, "strnil is \"%S\"", nil);
#if LITHIUM
@@ -333,7 +332,7 @@ void Lith_ResetPlayer(struct player *p)
}

#if LITHIUM
if(world.dbgItems)
if(dbgflag & dbgf_items)
{
for(i32 i = weapon_min; i < weapon_max; i++) {
struct weaponinfo const *info = &weaponinfo[i];


+ 2
- 0
source/Main/p_gui_bip.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_gui_bip.c: Info tab GUI.

#include "common.h"
#include "p_player.h"
#include "p_bip.h"


+ 2
- 0
source/Main/p_gui_cbi.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_gui_cbi.c: CBI tab GUI.

#include "common.h"
#include "p_player.h"
#include "w_world.h"


+ 3
- 1
source/Main/p_gui_upgrades.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_gui_upgrades.c: Upgrades tab GUI.

#include "u_common.h"
#include "w_world.h"

@@ -154,7 +156,7 @@ static void GUIUpgradeDescription(struct gui_state *g, struct player *p, struct
default: mark = "\Cnscr"; break;
}

if(upgr->info->cost) cost = StrParam("%S%s", scoresep(p->getCost(&upgr->info->shopdef)), mark);
if(upgr->info->cost) cost = StrParam("%s%s", scoresep(p->getCost(&upgr->info->shopdef)), mark);
else cost = L(st_free);

PrintText_str(cost, s_cbifont, CR_WHITE, 111,1, 30,1);


+ 3
- 1
source/Main/p_hud.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_hud.c: Generalized HUD functions.

#include "p_player.h"
#include "p_hud.h"
#include "p_hudid.h"
@@ -48,7 +50,7 @@ void Lith_HUD_Score(struct player *p, char const *fmt, i96 scrn, str font, str c
if(p->scoreaccumtime > 0)
{
SetFade(fid_scacum, 5, 0.1);
p->scoreaccumstr = StrParam("%c%S", p->scoreaccum >= 0 ? '+' : ' ', scoresep(p->scoreaccum));
p->scoreaccumstr = StrParam("%c%s", p->scoreaccum >= 0 ? '+' : ' ', scoresep(p->scoreaccum));
}

if(CheckFade(fid_schit1))


+ 8
- 6
source/Main/p_items.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_items.c: Inventory handling and UI.

#if LITHIUM
#include "common.h"
#include "p_player.h"
@@ -301,7 +303,7 @@ void Lith_PlayerUpdateInventory(struct player *p)
if(it->Tick) it->Tick(it);
}

script ext("ACS")
script_str ext("ACS")
void *Lith_ItemCreate(i32 w, i32 h)
{
str type = GetMembS(0, sm_InvType);
@@ -322,7 +324,7 @@ void *Lith_ItemCreate(i32 w, i32 h)
return nil;
}

script ext("ACS")
script_str ext("ACS")
bool Lith_ItemAttach(void *_item)
{
struct item *item = _item;
@@ -339,7 +341,7 @@ bool Lith_ItemAttach(void *_item)
return false;
}

script ext("ACS")
script_str ext("ACS")
void Lith_ItemDetach(void *_item)
{
struct item *item = _item;
@@ -349,7 +351,7 @@ void Lith_ItemDetach(void *_item)
item->Destroy(item);
}

script ext("ACS")
script_str ext("ACS")
void Lith_ItemUnlink(void *_item)
{
struct item *item = _item;
@@ -366,7 +368,7 @@ void Lith_ItemUnlink(void *_item)
}
}

script ext("ACS")
script_str ext("ACS")
bool Lith_ItemCanPlace(void *_item)
{
struct item *item = _item;
@@ -435,7 +437,7 @@ void Lith_CBITab_Items(struct gui_state *g, struct player *p)

if(sel->scr)
{
PrintTextFmt("(%S\Cnscr\C-)", scoresep(sel->scr));
PrintTextFmt("(%s\Cnscr\C-)", scoresep(sel->scr));
PrintText(s_cbifont, CR_WHITE, x_+18,1, y_,1);
}



+ 4
- 2
source/Main/p_log.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_log.c: Log UI and logging functions.

#include "common.h"
#include "p_log.h"
#include "p_player.h"
@@ -116,7 +118,7 @@ void Lith_PlayerLogEntry(struct player *p)
p->logF(LC(LANG "ENTER_FMT"), lm->name, time);
}

script ext("ACS")
script_str ext("ACS")
void Lith_LogS(i32 levl, i32 type)
{
str name = ServCallS(sm_GetLogName);
@@ -151,7 +153,7 @@ void Lith_PlayerUpdateLog(struct player *p)

void Lith_CBITab_Log(struct gui_state *g, struct player *p)
{
static int const ht = 10;
static i32 const ht = 10;

if(Lith_GUI_Button(g, .x = 25, 38, Pre(btnprev)))
if(--CBIState(g)->logsel < 0) CBIState(g)->logsel = p->log.mapsC - 1;


+ 55
- 0
source/Main/p_m_dbg.c View File

@@ -0,0 +1,55 @@
// Distributed under the CC0 public domain license.
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_m_dbg.c: Debug module.

#include "common.h"
#include "p_player.h"

void P_Dbg_InitPre(struct player *p)
{
LogDebug(log_sys, "%s", __func__);
}

void P_Dbg_InitPst(struct player *p)
{
LogDebug(log_sys, "%s", __func__);
}

void P_Dbg_Init(struct player *p)
{
LogDebug(log_sys, "%s", __func__);
}

void P_Dbg_ReInit(struct player *p)
{
LogDebug(log_sys, "%s", __func__);
}

void P_Dbg_Quit(struct player *p)
{
LogDebug(log_sys, "%s", __func__);
}

void P_Dbg_Dealloc(struct player *p)
{
LogDebug(log_sys, "%s", __func__);
}

void P_Dbg_TickPre(struct player *p)
{
LogDebug(log_sysV, "%s", __func__);
}

void P_Dbg_Tick(struct player *p)
{
LogDebug(log_sysV, "%s", __func__);
}

void P_Dbg_TickPst(struct player *p)
{
LogDebug(log_sysV, "%s", __func__);
}

// EOF

+ 7
- 5
source/Main/p_magic.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_magic.c: Magic weapon functions.

#if LITHIUM
#include "p_player.h"
#include "p_hudid.h"
@@ -9,7 +11,7 @@

// Extern Functions ----------------------------------------------------------|

script ext("ACS")
script_str ext("ACS")
void Lith_Blade(bool hit)
{
ACS_SetHudSize(800, 600);
@@ -19,7 +21,7 @@ void Lith_Blade(bool hit)
if(!p->onground) p->setVel(p->velx / 2, p->vely / 2, 0);
}

script ext("ACS")
script_str ext("ACS")
void Lith_Rend(bool hit, i32 set)
{
static i32 num;
@@ -36,7 +38,7 @@ void Lith_Rend(bool hit, i32 set)
if(!p->onground) p->setVel(p->velx / 2, p->vely / 2, 0);
}

script ext("ACS")
script_str ext("ACS")
void Lith_Feuer(bool left, bool fire)
{
withplayer(LocalPlayer)
@@ -79,7 +81,7 @@ void Lith_Feuer(bool left, bool fire)
}
}

script ext("ACS")
script_str ext("ACS")
void Lith_Cercle(void)
{
withplayer(LocalPlayer)
@@ -162,7 +164,7 @@ void Lith_Cercle(void)
}
}

script ext("ACS")
script_str ext("ACS")
void Lith_MagicSelect(i32 num)
{
withplayer(LocalPlayer)


+ 0
- 69
source/Main/p_misc.c View File

@@ -1,69 +0,0 @@
// Distributed under the CC0 public domain license.
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

#include "common.h"
#include "p_player.h"

script ext("ACS")
void Lith_GiveMeAllOfTheScore(void)
{
withplayer(LocalPlayer) p->giveScore(0x7FFFFFFFFFFFFFFFFFFFFFFFLL, true);
}

script ext("ACS")
void Lith_GiveHealthBonus(i32 amount)
{
withplayer(LocalPlayer)
{
amount += p->health;
if(amount > p->maxhealth + 100) amount = p->maxhealth + 100;
p->health = amount;
}
}

script ext("ACS")
void Lith_GiveHealth(i32 amount)
{
withplayer(LocalPlayer)
{
amount += p->health;
amount *= 1 + p->attr.attrs[at_vit] / 80.0;
if(amount > p->maxhealth) amount = p->maxhealth;
p->health = amount;
}
}

script ext("ACS")
bool Lith_CheckHealth()
{
withplayer(LocalPlayer) return p->health < p->maxhealth;
return 0;
}

script ext("ACS")
void Lith_Discount()
{
withplayer(LocalPlayer) p->discount = 0.9;
}

script type("net") ext("ACS")
void Lith_Glare(void)
{
withplayer(LocalPlayer)
{
ACS_FadeTo(255, 255, 255, 1.0, 0.0);

ACS_LocalAmbientSound(ss_player_glare, 127);
ACS_LineAttack(0, p->yaw, p->pitch, 1, so_Dummy, s_None,
32767.0, FHF_NORANDOMPUFFZ | FHF_NOIMPACTDECAL);

ACS_Delay(14);

ACS_FadeTo(255, 255, 255, 0.0, 0.2);

ACS_Delay(19);
}
}

// EOF

+ 2
- 0
source/Main/p_notes.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_notes.c: Saved notes UI.

#include "common.h"
#include "p_player.h"
#include "w_world.h"


+ 3
- 1
source/Main/p_obituary.c View File

@@ -2,11 +2,13 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_obituary.c: Obituary string formatting and dispatch.

#if LITHIUM
#include "common.h"
#include "p_player.h"

script ext("ACS")
script_str ext("ACS")
void Lith_Obituary(void)
{
static char const *pronoun[pro_max][5] = {


+ 5
- 3
source/Main/p_payout.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_payout.c: Level payout UI.

#if LITHIUM
#include "common.h"
#include "p_player.h"
@@ -38,7 +40,7 @@ void Lith_PlayerPayout(struct player *p)
\
if(i < 35) \
{ \
HudMessageF(s_cnfont, "%S\Cnscr", scoresep(lerplk(0, pay.name##scr, i / 34.0lk))); \
HudMessageF(s_cnfont, "%s\Cnscr", scoresep(lerplk(0, pay.name##scr, i / 34.0lk))); \
HudMessageParams(HUDMSG_FADEOUT, hid, CR_WHITE, 280.2, y + 0.1, 2, 0.2); \
} \
\
@@ -72,11 +74,11 @@ void Lith_PlayerPayout(struct player *p)
if(pay.itemmax) {GenCount("ARTIFACTS", item); counting |= pay.itemnum;}

if(i > 35) {y += 7; Head("TOTAL"); y += 16;}
if(i > 35 * 1.25) {Left("Tax"); Right("%S\Cnscr", scoresep(pay.tax)); y += 9;}
if(i > 35 * 1.25) {Left("Tax"); Right("%s\Cnscr", scoresep(pay.tax)); y += 9;}

if(i > 35 * 1.5)
{
Left("Total"); Right("%S\Cnscr", scoresep(pay.total)); y += 16;
Left("Total"); Right("%s\Cnscr", scoresep(pay.total)); y += 16;

Head("PAYMENT"); y += 16;
Left("Primary Account"); Right("%sTRANSACTION CLOSED", (i % 6) == 0 ? "\Cn" : "");


+ 2
- 0
source/Main/p_pickups.c View File

@@ -2,6 +2,8 @@
// By Alison Sanderson. Attribution is encouraged, though not required.
// See licenses/cc0.txt for more information.

// p_pickups.c: Pickup message handling.