Procházet zdrojové kódy

some minor crust removal

master
Alison Watson před 1 rokem
rodič
revize
836f283429
27 změnil soubory, kde provedl 195 přidání a 220 odebrání
  1. +3
    -3
      source/d_vm.c
  2. +24
    -68
      source/g_auto.c
  3. +1
    -1
      source/g_button.c
  4. +1
    -2
      source/g_checkbox.c
  5. +6
    -6
      source/g_scrollbar.c
  6. +2
    -3
      source/g_slider.c
  7. +1
    -2
      source/g_textbox.c
  8. +0
    -3
      source/include/common.h
  9. +39
    -33
      source/include/gui.h
  10. +2
    -0
      source/include/m_str.h
  11. +32
    -3
      source/m_str.c
  12. +1
    -1
      source/p_attrib.c
  13. +12
    -12
      source/p_gui_bip.c
  14. +5
    -5
      source/p_gui_upgrades.c
  15. +2
    -2
      source/p_hud.c
  16. +3
    -3
      source/p_log.c
  17. +9
    -8
      source/p_notes.c
  18. +4
    -4
      source/p_render.c
  19. +17
    -17
      source/p_settings.c
  20. +17
    -19
      source/p_shop.c
  21. +2
    -2
      source/p_weapons.c
  22. +1
    -1
      source/u_headsupdisd.c
  23. +0
    -1
      source/u_magic.c
  24. +1
    -1
      source/w_monster.c
  25. +1
    -3
      tools/monc.rb
  26. +2
    -6
      tools/upgc.rb
  27. +7
    -11
      tools/wepc.rb

+ 3
- 3
source/d_vm.c Zobrazit soubor

@@ -273,8 +273,8 @@ script static void TerminalGUI(struct player *p, u32 tact) {
/* text */
twidth = 640, theigh = 480,
tright = twidth,
ttop = theigh*.08,
tbottom = theigh*.75,
ttop = theigh*0.08,
tbottom = theigh*0.75,
tleft = twidth/2 - 10,

tmidx = tright/2, tmidy = tbottom/2,
@@ -408,7 +408,7 @@ script static void DialogueGUI(struct player *p) {
u32 adr = MemB2_G(StructOfs(OPT, NAML, i));
cstr txt = LanguageC(LANG "OPT_%s", MemSC_G(adr));

if(G_Button_Id(&gst, i, txt, 45, y, Pre(btndlgsel))) {
if(G_Button_HId(&gst, i, txt, 45, y, Pre(btndlgsel))) {
MemB1_S(VAR_UACT, UACT_SELOPTION);
MemB1_S(VAR_OPT_SEL, i);
}


+ 24
- 68
source/g_auto.c Zobrazit soubor

@@ -15,21 +15,19 @@
#include "p_player.h"
#include "w_world.h"

/* Static Objects ---------------------------------------------------------- */

noinit static char tcbuf[4096];

/* Extern Functions -------------------------------------------------------- */

void G_Auto(struct gui_state *g, u32 id, i32 x, i32 y, i32 w, i32 h, bool slide)
{
void G_Auto(struct gui_state *g, u32 id, i32 x, i32 y, i32 w, i32 h,
bool slide) {
x += g->ox;
y += g->oy;

/* check clip versus cursor (if clipping), then check control versus cursor */
if(!g->useclip || aabb_point(g->clpxS, g->clpyS, g->clpxE, g->clpyE, g->cx, g->cy))
if(aabb_point(x, y, w, h, g->cx, g->cy))
{
/* check clip versus cursor (if clipping), then check control
* versus cursor
*/
if((!g->useclip ||
aabb_point(g->clpxS, g->clpyS, g->clpxE, g->clpyE, g->cx, g->cy)) &&
aabb_point(x, y, w, h, g->cx, g->cy)) {
g->hot = id;

if(g->active == 0 && g->clicklft)
@@ -44,19 +42,18 @@ void G_Auto(struct gui_state *g, u32 id, i32 x, i32 y, i32 w, i32 h, bool slide)
}
}

void G_Init(struct gui_state *g, void *state)
{
void G_Init(struct gui_state *g, void *state) {
g->state = state;
g->gfxprefix = c":UI:";
g->gfxprefix = ":UI:";
}

void G_UpdateState(struct gui_state *g, struct player *p)
{
void G_UpdateState(struct gui_state *g, struct player *p) {
/* Due to ZDoom being ZDoom, GetUserCVar with invertmouse does
* nothing. This breaks network sync so we can only do it in
* single-player.
*/
bool inverted = p->getCVarI(sc_player_invertmouse);

/* Due to ZDoom being ZDoom, GetUserCVar with invertmouse does nothing.
* This breaks network sync so we can only do it in single-player.
*/
Str(invertmouse, s"invertmouse");
if(singleplayer) inverted |= ACS_GetCVar(invertmouse);

@@ -84,8 +81,7 @@ void G_UpdateState(struct gui_state *g, struct player *p)
g->slidetime++;
}

void G_Begin(struct gui_state *g, i32 w, i32 h)
{
void G_Begin(struct gui_state *g, i32 w, i32 h) {
if(!w) w = 320;
if(!h) h = 200;

@@ -94,8 +90,7 @@ void G_Begin(struct gui_state *g, i32 w, i32 h)
SetSize(g->w = w, g->h = h);
}

void G_End(struct gui_state *g, enum cursor curs)
{
void G_End(struct gui_state *g, enum cursor curs) {
str cgfx;

switch(curs) {
@@ -118,8 +113,7 @@ void G_End(struct gui_state *g, enum cursor curs)
g->active = 0;
}

void G_Clip(struct gui_state *g, i32 x, i32 y, i32 w, i32 h, i32 ww)
{
void G_Clip(struct gui_state *g, i32 x, i32 y, i32 w, i32 h, i32 ww) {
g->useclip = true;
g->clpxE = w;
g->clpyE = h;
@@ -128,57 +122,19 @@ void G_Clip(struct gui_state *g, i32 x, i32 y, i32 w, i32 h, i32 ww)
SetClipW(g->clpxS = x, g->clpyS = y, w, h, ww);
}

void G_ClipRelease(struct gui_state *g)
{
void G_ClipRelease(struct gui_state *g) {
g->useclip = g->clpxS = g->clpyS = g->clpxE = g->clpyE = 0;
ClearClip();
}

void G_TypeOn(struct gui_state *g, struct gui_typ *typeon, str text)
{
void G_TypeOn(struct gui_state *g, struct gui_typ *typeon, str text) {
typeon->txt = text;
typeon->len = ACS_StrLen(text);
typeon->pos = 0;
}

#define RemoveTextColorsImpl() \
i32 j = 0; \
\
if(size > countof(tcbuf)) return nil; \
\
for(i32 i = 0; i < size; i++) \
{ \
if(s[i] == '\C') \
{ \
i++; \
if(s[i] == '[') \
while(s[i] && s[i++] != ']'); \
else \
i++; \
} \
\
if(i >= size || j >= size || !s[i]) \
break; \
\
tcbuf[j++] = s[i]; \
} \
\
tcbuf[j++] = '\0'; \
\
return tcbuf;

cstr RemoveTextColors_str(astr s, i32 size)
{
RemoveTextColorsImpl();
}

cstr RemoveTextColors(cstr s, i32 size)
{
RemoveTextColorsImpl();
}

struct gui_typ const *G_TypeOnUpdate(struct gui_state *g, struct gui_typ *typeon)
{
struct gui_typ const *G_TypeOnUpdate(struct gui_state *g,
struct gui_typ *typeon) {
i32 num = ACS_Random(2, 15);

if((typeon->pos += num) > typeon->len)
@@ -209,8 +165,8 @@ i32 G_Tabs(struct gui_state *g, u32 *st, char const (*names)[20], size_t num,
i32 xp = 0;

for(i32 i = 0; i < num; i++) {
if(G_Button_Id(g, xp + yp * 6, names[i], gui_p.btntab.w * xp + x,
gui_p.btntab.h * yp + y, i == *st, .preset = &gui_p.btntab)) {
if(G_Button_HId(g, xp + yp * 6, names[i], gui_p.btntab.w * xp + x,
gui_p.btntab.h * yp + y, i == *st, Pre(btntab))) {
*st = i;
}



+ 1
- 1
source/g_button.c Zobrazit soubor

@@ -14,7 +14,7 @@
#include "common.h"
#include "p_player.h"

bool G_Button_Impl(struct gui_state *g, u32 id, struct gui_arg_btn const *a) {
bool G_Button_Imp(struct gui_state *g, u32 id, struct gui_arg_btn const *a) {
struct gui_pre_btn const *pre = a->preset ? a->preset : &gui_p.btndef;

if(!a->disabled)


+ 1
- 2
source/g_checkbox.c Zobrazit soubor

@@ -14,8 +14,7 @@
#include "common.h"
#include "p_player.h"

bool G_Checkbox_Impl(struct gui_state *g, u32 id, struct gui_arg_cbx const *a)
{
bool G_ChkBox_Imp(struct gui_state *g, u32 id, struct gui_arg_cbx const *a) {
struct gui_pre_cbx const *pre = a->preset ? a->preset : &gui_p.cbxdef;

if(!a->disabled)


+ 6
- 6
source/g_scrollbar.c Zobrazit soubor

@@ -14,10 +14,10 @@
#include "common.h"
#include "p_player.h"

/* This function is excessively commented in case I need to change it. */
/* Reading this function will cause a 5x1d20 hit to your SAN stat. Beware! */
void G_ScrollBegin_Impl(struct gui_state *g, u32 id, struct gui_arg_scr const *a)
{
/* This function is excessively commented in case I need to change it.
* Reading this function will cause a 5x1d20 hit to your SAN stat. Beware!
*/
void G_ScrBeg_Imp(struct gui_state *g, u32 id, struct gui_arg_scr const *a) {
struct gui_pre_scr const *pre = a->preset ? a->preset : &gui_p.scrdef;
struct gui_scr *scr = a->st;

@@ -157,7 +157,7 @@ void G_ScrollBegin_Impl(struct gui_state *g, u32 id, struct gui_arg_scr const *a
G_Clip(g, x, ory, a->w, realh, a->ww);
}

void G_ScrollEnd(struct gui_state *g, struct gui_scr *scr)
void G_ScrEnd(struct gui_state *g, struct gui_scr *scr)
{
/* reset offsets */
g->ox -= scr->ox;
@@ -167,7 +167,7 @@ void G_ScrollEnd(struct gui_state *g, struct gui_scr *scr)
G_ClipRelease(g);
}

bool G_ScrollOcclude(struct gui_state *g, struct gui_scr const *scr, i32 y, i32 h)
bool G_ScrOcc(struct gui_state *g, struct gui_scr const *scr, i32 y, i32 h)
{
return y > scr->occludeE || (h && (y + h) - scr->occludeS < 0);
}


+ 2
- 3
source/g_slider.c Zobrazit soubor

@@ -14,8 +14,7 @@
#include "common.h"
#include "p_player.h"

k64 G_Slider_Impl(struct gui_state *g, u32 id, struct gui_arg_sld const *a)
{
k64 G_Slider_Imp(struct gui_state *g, u32 id, struct gui_arg_sld const *a) {
struct gui_pre_sld const *pre = a->preset ? a->preset : &gui_p.slddef;

k64 w = pre->w - (pre->pad * 2);
@@ -75,7 +74,7 @@ k64 G_Slider_Impl(struct gui_state *g, u32 id, struct gui_arg_sld const *a)
if(pre->font)
{
cstr suf = a->suf ? a->suf : "";
k64 amt = roundlk(norm * 100.lk, 10) / 100.lk;
k64 amt = roundlk(norm * 100.0lk, 10) / 100.0lk;
if(a->integ) PrintTextFmt("%i%s", (i32)amt, suf);
else PrintTextFmt("%.1k%s", (k32)amt, suf);



+ 1
- 2
source/g_textbox.c Zobrazit soubor

@@ -17,8 +17,7 @@
#include "m_cps.h"
#include "m_char.h"

struct gui_txt *G_TextBox_Impl(struct gui_state *g, u32 id, struct gui_arg_txt const *a)
{
struct gui_txt *G_TxtBox_Imp(struct gui_state *g, u32 id, struct gui_arg_txt const *a) {
struct gui_txt *st = a->st;

G_Auto(g, id, a->x, a->y, 260, 10);


+ 0
- 3
source/include/common.h Zobrazit soubor

@@ -113,9 +113,6 @@
#define InvNum ACS_CheckInventory
#define InvTake ACS_TakeInventory

#define StrEntON _Pragma("GDCC STRENT_LITERAL ON")
#define StrEntOFF _Pragma("GDCC STRENT_LITERAL OFF")

/* Types ------------------------------------------------------------------- */

enum {


+ 39
- 33
source/include/gui.h Zobrazit soubor

@@ -19,25 +19,30 @@
#define Pre(name) .preset = &gui_p.name

/* Fixed ID */
#define G_Button_FId(g, id, ...) G_Button_Impl (g, id, &(struct gui_arg_btn const){__VA_ARGS__})
#define G_Checkbox_FId(g, id, ...) G_Checkbox_Impl (g, id, &(struct gui_arg_cbx const){__VA_ARGS__})
#define G_ScrollBegin_FId(g, id, ...) G_ScrollBegin_Impl(g, id, &(struct gui_arg_scr const){__VA_ARGS__})
#define G_Slider_FId(g, id, ...) G_Slider_Impl (g, id, &(struct gui_arg_sld const){__VA_ARGS__})
#define G_TextBox_FId(g, id, ...) G_TextBox_Impl (g, id, &(struct gui_arg_txt const){__VA_ARGS__})

/* Dynamic ID */
#define G_Button_Id(g, id, ...) G_Button_FId (g, id + LineHash, __VA_ARGS__)
#define G_Checkbox_Id(g, id, ...) G_Checkbox_FId (g, id + LineHash, __VA_ARGS__)
#define G_ScrollBegin_Id(g, id, ...) G_ScrollBegin_FId(g, id + LineHash, __VA_ARGS__)
#define G_Slider_Id(g, id, ...) G_Slider_FId (g, id + LineHash, __VA_ARGS__)
#define G_TextBox_Id(g, id, ...) G_TextBox_FId (g, id + LineHash, __VA_ARGS__)

/* Dynamic */
#define G_Button(g, ...) G_Button_Id (g, 0, __VA_ARGS__)
#define G_Checkbox(g, ...) G_Checkbox_Id (g, 0, __VA_ARGS__)
#define G_ScrollBegin(g, ...) G_ScrollBegin_Id(g, 0, __VA_ARGS__)
#define G_Slider(g, ...) G_Slider_Id (g, 0, __VA_ARGS__)
#define G_TextBox(g, ...) G_TextBox_Id (g, 0, __VA_ARGS__)
#define G_Args(ty, ...) &(struct gui_arg_##ty const){__VA_ARGS__}
#define G_Button_FId(g, id, ...) G_Button_Imp(g, id, G_Args(btn, __VA_ARGS__))
#define G_ChkBox_FId(g, id, ...) G_ChkBox_Imp(g, id, G_Args(cbx, __VA_ARGS__))
#define G_ScrBeg_FId(g, id, ...) G_ScrBeg_Imp(g, id, G_Args(scr, __VA_ARGS__))
#define G_Slider_FId(g, id, ...) G_Slider_Imp(g, id, G_Args(sld, __VA_ARGS__))
#define G_TxtBox_FId(g, id, ...) G_TxtBox_Imp(g, id, G_Args(txt, __VA_ARGS__))
#define G_WinBeg_FId(g, id, ...) G_WinBeg_Imp(g, id, G_Args(win, __VA_ARGS__))

/* Hashed ID */
#define G_HId(id) (id) + LineHash
#define G_Button_HId(g, id, ...) G_Button_FId(g, G_HId(id), __VA_ARGS__)
#define G_ChkBox_HId(g, id, ...) G_ChkBox_FId(g, G_HId(id), __VA_ARGS__)
#define G_ScrBeg_HId(g, id, ...) G_ScrBeg_FId(g, G_HId(id), __VA_ARGS__)
#define G_Slider_HId(g, id, ...) G_Slider_FId(g, G_HId(id), __VA_ARGS__)
#define G_TxtBox_HId(g, id, ...) G_TxtBox_FId(g, G_HId(id), __VA_ARGS__)
#define G_WinBeg_HId(g, id, ...) G_WinBeg_FId(g, G_HId(id), __VA_ARGS__)

/* Hashed */
#define G_Button(g, ...) G_Button_HId(g, 0, __VA_ARGS__)
#define G_ChkBox(g, ...) G_ChkBox_HId(g, 0, __VA_ARGS__)
#define G_ScrBeg(g, ...) G_ScrBeg_HId(g, 0, __VA_ARGS__)
#define G_Slider(g, ...) G_Slider_HId(g, 0, __VA_ARGS__)
#define G_TxtBox(g, ...) G_TxtBox_HId(g, 0, __VA_ARGS__)
#define G_WinBeg(g, ...) G_WinBeg_HId(g, 0, __VA_ARGS__)

#define G_GenPreset(type, def) \
type pre; \
@@ -54,12 +59,12 @@
#define G_ScrollReset(g, st) \
(*(st) = (struct gui_scr){})

#define G_TextBox_Reset(st) ((st)->tbptr = 0)
#define G_TxtBoxRes(st) ((st)->tbptr = 0)

#define G_TextBox_OnTextEntered(st) \
#define G_TxtBoxEvt(st) \
__with(cstr txt_buf = Cps_Expand(st->txtbuf, 0, st->tbptr);) \
ifauto(cstr, _c, strchr(txt_buf, '\n')) \
__with(size_t txt_len = _c - txt_buf; G_TextBox_Reset(st);)
__with(size_t txt_len = _c - txt_buf; G_TxtBoxRes(st);)

/* Types ------------------------------------------------------------------- */

@@ -284,9 +289,6 @@ optargs(1)
void G_Clip(struct gui_state *g, i32 x, i32 y, i32 w, i32 h, i32 ww);
void G_ClipRelease(struct gui_state *g);

cstr RemoveTextColors_str(astr s, i32 size);
cstr RemoveTextColors (cstr s, i32 size);

void G_TypeOn(struct gui_state *g, struct gui_typ *typeon, str text);
struct gui_typ const *G_TypeOnUpdate(struct gui_state *g, struct gui_typ *typeon);

@@ -295,14 +297,18 @@ bool G_Filler(i32 x, i32 y, u32 *fill, u32 tics, bool held);
i32 G_Tabs(struct gui_state *g, u32 *st, char const (*names)[20], size_t num,
i32 x, i32 y, i32 yp);

void G_ScrollEnd(struct gui_state *g, struct gui_scr *scr);
void G_ScrEnd(struct gui_state *g, struct gui_scr *scr);
optargs(1)
bool G_ScrollOcclude(struct gui_state *g, struct gui_scr const *scr, i32 y, i32 h);

bool G_Button_Impl (struct gui_state *g, u32 id, struct gui_arg_btn const *a);
bool G_Checkbox_Impl (struct gui_state *g, u32 id, struct gui_arg_cbx const *a);
void G_ScrollBegin_Impl(struct gui_state *g, u32 id, struct gui_arg_scr const *a);
k64 G_Slider_Impl (struct gui_state *g, u32 id, struct gui_arg_sld const *a);
struct gui_txt *G_TextBox_Impl (struct gui_state *g, u32 id, struct gui_arg_txt const *a);
bool G_ScrOcc(struct gui_state *g, struct gui_scr const *scr, i32 y, i32 h);

#define G_ImpArgs(ty) struct gui_state *g, u32 id, struct gui_arg_##ty const *a
bool G_Button_Imp(G_ImpArgs(btn));
bool G_ChkBox_Imp(G_ImpArgs(cbx));
void G_ScrBeg_Imp(G_ImpArgs(scr));
k64 G_Slider_Imp(G_ImpArgs(sld));
struct gui_txt *G_TxtBox_Imp(G_ImpArgs(txt));
#if 0
void G_WinBeg_Imp(G_ImpArgs(win));
#endif

#endif

+ 2
- 0
source/include/m_str.h Zobrazit soubor

@@ -68,5 +68,7 @@ str LanguageV(str name);
char *LanguageVC(char *out, cstr name);
char *LanguageCV(char *out, cstr name, ...);
str LanguageNull(cstr fmt, ...);
cstr RemoveTextColors_str(astr s, i32 size);
cstr RemoveTextColors (cstr s, i32 size);

/* EOF */

+ 32
- 3
source/m_str.c Zobrazit soubor

@@ -29,10 +29,8 @@
for(; *s; s++) ret = *s + 101 * ret; \
return ret

StrEntON
#define X(n, s) str const n = s;
#define X(n, s) str const n = Spf s;
#include "m_stab.h"
StrEntOFF

str l_strupper(str in)
{
@@ -228,4 +226,35 @@ str LanguageNull(cstr fmt, ...)
return name == alias ? snil : alias;
}

noinit static char tcbuf[4096];

#define RemoveTextColorsImpl() \
i32 j = 0; \
\
if(size > countof(tcbuf)) return nil; \
\
for(i32 i = 0; i < size; i++) { \
if(s[i] == '\C') { \
i++; \
if(s[i] == '[') while(s[i] && s[i++] != ']'); \
else i++; \
} \
\
if(i >= size || j >= size || !s[i]) break; \
\
tcbuf[j++] = s[i]; \
} \
\
tcbuf[j++] = '\0'; \
\
return tcbuf;

cstr RemoveTextColors_str(astr s, i32 size) {
RemoveTextColorsImpl();
}

cstr RemoveTextColors(cstr s, i32 size) {
RemoveTextColorsImpl();
}

/* EOF */

+ 1
- 1
source/p_attrib.c Zobrazit soubor

@@ -31,7 +31,7 @@ static void DrawAttr(struct gui_state *g, i32 x, i32 y, struct player *p, i32 at
k32 helptrns = 0.5;

if(p->attr.points)
if(G_Button_Id(g, at, .x = x-42 + gui_p.btnnext.w, y-2, Pre(btnnext), .slide = true))
if(G_Button_HId(g, at, .x = x-42 + gui_p.btnnext.w, y-2, Pre(btnnext), .slide = true))
{
p->attr.points--;
p->attr.attrs[at]++;


+ 12
- 12
source/p_gui_bip.c Zobrazit soubor

@@ -84,8 +84,8 @@ static void DrawPage(struct gui_state *g, struct player *p, struct page *page) {
i32 oy = 0;

if(height) {
G_ScrollBegin(g, &CBIState(g)->bipinfoscr, 100, 40, 200, 180,
height * 8 + 20, 184);
G_ScrBeg(g, &CBIState(g)->bipinfoscr, 100, 40, 200, 180,
height * 8 + 20, 184);
oy = g->oy - 40;
} else {
SetClipW(110, 40, 201, 180, 185);
@@ -126,8 +126,8 @@ static void DrawPage(struct gui_state *g, struct player *p, struct page *page) {
__nprintf("%.*S", typeon->pos, typeon->txt);
DrawText(ACS_EndStrParam(), g->defcr, 111, 60);

if(height) G_ScrollEnd(g, &CBIState(g)->bipinfoscr);
else ClearClip();
if(height) G_ScrEnd(g, &CBIState(g)->bipinfoscr);
else ClearClip();
}

static void MainUI(struct gui_state *g, struct player *p) {
@@ -144,7 +144,7 @@ static void MainUI(struct gui_state *g, struct player *p) {
PrintTextChS(s); \
PrintTextA(s_smallfnt, g->defcr, 105,1, 85+n,1, 0.7); \
s = LanguageC(LANG "BIP_NAME_%s", P_BIP_CategoryToName(name)); \
if(G_Button_Id(g, name, s, 45, 85 + n, Pre(btnbipmain))) { \
if(G_Button_HId(g, name, s, 45, 85 + n, Pre(btnbipmain))) { \
p->bip.curcategory = name; \
p->bip.curpage = nil; \
} \
@@ -161,7 +161,7 @@ static void CategoryUI(struct gui_state *g, struct player *p) {

if(categ == BIPC_EXTRA) goto draw;

G_ScrollBegin(g, &CBIState(g)->bipscr, 15, 50, gui_p.btnlist.w, 170, gui_p.btnlist.h * n);
G_ScrBeg(g, &CBIState(g)->bipscr, 15, 50, gui_p.btnlist.w, 170, gui_p.btnlist.h * n);

u32 i = 0;
for_page() {
@@ -171,7 +171,7 @@ static void CategoryUI(struct gui_state *g, struct player *p) {

i32 y = gui_p.btnlist.h * i++;

if(G_ScrollOcclude(g, &CBIState(g)->bipscr, y, gui_p.btnlist.h))
if(G_ScrOcc(g, &CBIState(g)->bipscr, y, gui_p.btnlist.h))
continue;

bool lock = !get_bit(page->flags, _page_unlocked) || p->bip.curpage == page;
@@ -179,11 +179,11 @@ static void CategoryUI(struct gui_state *g, struct player *p) {
char name[128] = "\Ci";
strcpy(p->bip.curpage == page ? &name[2] : name, GetShortName(page));

if(G_Button_Id(g, i, name, 0, y, lock, Pre(btnlist)))
if(G_Button_HId(g, i, name, 0, y, lock, Pre(btnlist)))
SetCurPage(g, p, page);
}

G_ScrollEnd(g, &CBIState(g)->bipscr);
G_ScrEnd(g, &CBIState(g)->bipscr);

draw:
if(p->bip.curpage) DrawPage(g, p, p->bip.curpage);
@@ -210,11 +210,11 @@ i32 SearchPage(struct player *p, struct page *page, cstr query) {
}

static void SearchUI(struct gui_state *g, struct player *p) {
struct gui_txt *st = G_TextBox(g, &CBIState(g)->bipsearch, 23, 65, p);
struct gui_txt *st = G_TxtBox(g, &CBIState(g)->bipsearch, 23, 65, p);

p->bip.lastcategory = BIPC_MAIN;

G_TextBox_OnTextEntered(st) {
G_TxtBoxEvt(st) {
/* That's a lot of numbers... */
struct extraname {
u64 crc;
@@ -259,7 +259,7 @@ static void SearchUI(struct gui_state *g, struct player *p) {
struct page *page = p->bip.result[i];
cstr flname = GetFullName(page);

if(G_Button_Id(g, i, flname, 70, 95 + (i * 10), Pre(btnbipmain))) {
if(G_Button_HId(g, i, flname, 70, 95 + (i * 10), Pre(btnbipmain))) {
p->bip.lastcategory = p->bip.curcategory;
p->bip.curcategory = page->info->category;
SetCurPage(g, p, page);


+ 5
- 5
source/p_gui_upgrades.c Zobrazit soubor

@@ -53,7 +53,7 @@ static void GUIUpgradesList(struct gui_state *g, struct player *p) {
PrintTextFmt(LC(LANG "CAT_FILTER"), filter_name);
PrintText(s_smallfnt, g->defcr, 15,1, 215,1);

G_ScrollBegin(g, &CBIState(g)->upgrscr, 15, 36, gui_p.btnlist.w, 178, gui_p.btnlist.h * numbtns);
G_ScrBeg(g, &CBIState(g)->upgrscr, 15, 36, gui_p.btnlist.w, 178, gui_p.btnlist.h * numbtns);

i32 curcategory = -1;

@@ -70,7 +70,7 @@ static void GUIUpgradesList(struct gui_state *g, struct player *p) {

y += gui_p.btnlist.h;

if(G_ScrollOcclude(g, &CBIState(g)->upgrscr, y, gui_p.btnlist.h))
if(G_ScrOcc(g, &CBIState(g)->upgrscr, y, gui_p.btnlist.h))
continue;

cstr color;
@@ -92,7 +92,7 @@ static void GUIUpgradesList(struct gui_state *g, struct player *p) {
char *name = LanguageC(LANG "UPGRADE_TITLE_%S", upgr->info->name);

i32 *upgrsel = &CBIState(g)->upgrsel;
if(G_Button_Id(g, _i, name, 0, y, _i == *upgrsel, .color = color, .preset = pre))
if(G_Button_HId(g, _i, name, 0, y, _i == *upgrsel, .color = color, .preset = pre))
*upgrsel = _i;

for(i32 i = 0; i < 4; i++) {
@@ -104,7 +104,7 @@ static void GUIUpgradesList(struct gui_state *g, struct player *p) {
}
}

G_ScrollEnd(g, &CBIState(g)->upgrscr);
G_ScrEnd(g, &CBIState(g)->upgrscr);
}

static void GUIUpgradeRequirements(struct gui_state *g, struct player *p, struct upgrade *upgr) {
@@ -229,7 +229,7 @@ static void GUIUpgradeButtons(struct gui_state *g, struct player *p, struct upgr
ACS_PrintChar('1' + i);
PrintText(s_lmidfont, crs[i], 220 + i * 20,2, 215,1);

if(G_Checkbox_Id(g, i, get_bit(upgr->agroups, i), 221 + i * 20, 211)) {
if(G_ChkBox_HId(g, i, get_bit(upgr->agroups, i), 221 + i * 20, 211)) {
tog_bit(upgr->agroups, i);
P_Data_Save(p);
}


+ 2
- 2
source/p_hud.c Zobrazit soubor

@@ -22,8 +22,8 @@ void HUD_WeaponSlots(struct player *p, i32 cr_one, i32 cr_two, i32 cr_many, i32
for(i32 i = 1; i < SLOT_MAX; i++)
ifauto(i32, slot, p->weapon.slot[i])
{
k32 x = _x+.2 - 8 * (SLOT_MAX - i);
k32 y = _y+.2;
k32 x = _x+0.2 - 8 * (SLOT_MAX - i);
k32 y = _y+0.2;
i32 cr;
switch(slot) {
case 1: cr = cr_one; break;


+ 3
- 3
source/p_log.c Zobrazit soubor

@@ -146,18 +146,18 @@ void P_CBI_TabLog(struct gui_state *g, struct player *p) {

PrintText_str(lm->name, s_lmidfont, g->defcr, 28+gui_p.btnprev.w+gui_p.btnnext.w,1, 40,1);

G_ScrollBegin(g, &CBIState(g)->logscr, 15, 50, 280, 175, lm->dataC * ht);
G_ScrBeg(g, &CBIState(g)->logscr, 15, 50, 280, 175, lm->dataC * ht);

for(i32 i = 0; i < lm->dataC; i++) {
i32 const y = ht * i;

if(G_ScrollOcclude(g, &CBIState(g)->logscr, y, ht)) continue;
if(G_ScrOcc(g, &CBIState(g)->logscr, y, ht)) continue;

PrintSprite(sp_UI_LogList, g->ox,1, y + g->oy,1);
PrintText_str(lm->dataV[i].inf, s_smallfnt, CR_GREEN, g->ox + 2,1, y + g->oy + 1,1);
}

G_ScrollEnd(g, &CBIState(g)->logscr);
G_ScrEnd(g, &CBIState(g)->logscr);
}

script void HUD_Log(struct player *p, i32 cr, i32 x, i32 yy) {


+ 9
- 8
source/p_notes.c Zobrazit soubor

@@ -20,27 +20,28 @@ void P_CBI_TabNotes(struct gui_state *g, struct player *p)
{
Str(edit, sLANG "EDIT");

struct gui_txt *st = G_TextBox(g, &CBIState(g)->notebox, 48, 40, p);
struct gui_txt *st = G_TxtBox(g, &CBIState(g)->notebox, 48, 40, p);

PrintText_str(L(edit), s_smallfnt, g->defcr, 32,2, 41,0);
if(G_Checkbox(g, CBIState(g)->noteedit, 34, 37))
if(G_ChkBox(g, CBIState(g)->noteedit, 34, 37))
CBIState(g)->noteedit = !CBIState(g)->noteedit;

if(G_Button(g, LC(LANG "CLEAR"), 16, 50, Pre(btnclear)))
G_TextBox_Reset(st);
G_TxtBoxRes(st);

G_ScrollBegin(g, &CBIState(g)->notescr, 15, 63, 280, 160, 30 * countof(p->notes), 240);
G_ScrBeg(g, &CBIState(g)->notescr, 15, 63, 280, 160, 30 * countof(p->notes), 240);

for(i32 i = 0; i < countof(p->notes); i++)
{
if(G_ScrollOcclude(g, &CBIState(g)->notescr, i * 30, 30))
if(G_ScrOcc(g, &CBIState(g)->notescr, i * 30, 30))
continue;

PrintTextFmt(LC(LANG "NOTE_FMT"), i + 1);
PrintText(s_lmidfont, g->defcr, g->ox+2,1, i * 30 + g->oy,1);

if(G_Button_Id(g, i, p->notes[i] ? p->notes[i] : LC(LANG "EMPTY"),
44, i * 30, .disabled = !CBIState(g)->noteedit, Pre(btnnote)))
if(G_Button_HId(g, i, p->notes[i] ? p->notes[i] : LC(LANG "EMPTY"),
44, i * 30, .disabled = !CBIState(g)->noteedit,
Pre(btnnote)))
{
i32 l = CBIState(g)->notebox.tbptr;
cstr s = Cps_Expand(CBIState(g)->notebox.txtbuf, 0, l);
@@ -53,7 +54,7 @@ void P_CBI_TabNotes(struct gui_state *g, struct player *p)
}
}

G_ScrollEnd(g, &CBIState(g)->notescr);
G_ScrEnd(g, &CBIState(g)->notescr);
}

/* EOF */

+ 4
- 4
source/p_render.c Zobrazit soubor

@@ -81,8 +81,8 @@ sync void P_TeleportIn(struct player *p) {

for(i32 i = 18, j = 18; i >= 1; i--) {
ACS_Delay(1);
k32 w = 1 + (i / 18.lk / 3.lk * 50);
k32 h = 1 + (j / 18.lk / 8.lk * 10);
k32 w = 1 + (i / 18.0lk / 3.0lk * 50);
k32 h = 1 + (j / 18.0lk / 8.0lk * 10);
SetSize(320, 200);
PrintSprite(sp_Terminal_Teleport, 160,0, 100,0);
SetSize(640 / w, 480 * h);
@@ -97,8 +97,8 @@ sync void P_TeleportOut(struct player *p) {

for(i32 i = 1, j = 1; i <= 18; i++) {
ACS_Delay(1);
k32 w = 1 + (i / 18.lk / 3.lk * 50);
k32 h = 1 + (j / 18.lk / 8.lk * 10);
k32 w = 1 + (i / 18.0lk / 3.0lk * 50);
k32 h = 1 + (j / 18.0lk / 8.0lk * 10);
SetSize(320, 200);
PrintSprite(sp_Terminal_Teleport, 160,0, 100,0);
SetSize(640 / w, 480 * h);


+ 17
- 17
source/p_settings.c Zobrazit soubor

@@ -120,9 +120,9 @@ void S_boole(struct set_parm const *sp) {

S_label(sp);

if(G_Button_Id(sp->g, sp->y, v ? LC(LANG "ON") : LC(LANG "OFF"),
_rght - gui_p.btnlist.w, sp->y, Pre(btnlist),
.fill = {&CBIState(sp->g)->settingsfill, sp->st->fill})) {
if(G_Button_HId(sp->g, sp->y, v ? LC(LANG "ON") : LC(LANG "OFF"),
_rght - gui_p.btnlist.w, sp->y, Pre(btnlist),
.fill = {&CBIState(sp->g)->settingsfill, sp->st->fill})) {
v = !v;
sp->st->cb_g.b(sp, &v);
}
@@ -135,9 +135,9 @@ void S_integ(struct set_parm const *sp) {

S_label(sp);

if((diff = G_Slider_Id(sp->g, sp->y, _rght - gui_p.slddef.w, sp->y,
sp->st->bnd.i.min, sp->st->bnd.i.max, v, true,
.suf = LC(suff)))) {
if((diff = G_Slider_HId(sp->g, sp->y, _rght - gui_p.slddef.w, sp->y,
sp->st->bnd.i.min, sp->st->bnd.i.max, v, true,
.suf = LC(suff)))) {
v += diff;
sp->st->cb_g.i(sp, &v);
}
@@ -150,9 +150,9 @@ void S_fixed(struct set_parm const *sp) {

S_label(sp);

if((diff = G_Slider_Id(sp->g, sp->y, _rght - gui_p.slddef.w, sp->y,
sp->st->bnd.k.min, sp->st->bnd.k.max, v,
.suf = LC(suff)))) {
if((diff = G_Slider_HId(sp->g, sp->y, _rght - gui_p.slddef.w, sp->y,
sp->st->bnd.k.min, sp->st->bnd.k.max, v,
.suf = LC(suff)))) {
v = (i32)((v + diff) * 100) / 100.0k;
sp->st->cb_g.k(sp, &v);
}
@@ -167,14 +167,14 @@ void S_enume(struct set_parm const *sp) {

S_label(sp);

if(G_Button_Id(sp->g, sp->y, .x = _rght - btw * 2, sp->y, v <= min,
Pre(btnprevs))) {
if(G_Button_HId(sp->g, sp->y, .x = _rght - btw * 2, sp->y, v <= min,
Pre(btnprevs))) {
v--;
sp->st->cb_g.i(sp, &v);
}

if(G_Button_Id(sp->g, sp->y, .x = _rght - btw, sp->y, v >= max,
Pre(btnnexts))) {
if(G_Button_HId(sp->g, sp->y, .x = _rght - btw, sp->y, v >= max,
Pre(btnnexts))) {
v++;
sp->st->cb_g.i(sp, &v);
}
@@ -395,8 +395,8 @@ void P_CBI_TabSettings(struct gui_state *g, struct player *p) {
if(S_isEnabled(&set[i], p))
set_num++;

G_ScrollBegin(g, &CBIState(g)->settingscr, 15, 30 + yp, _rght,
192 - yp, set_num * 10);
G_ScrBeg(g, &CBIState(g)->settingscr, 15, 30 + yp, _rght, 192 - yp,
set_num * 10);

struct set_parm sp = {p, g, 0, 0};

@@ -404,14 +404,14 @@ void P_CBI_TabSettings(struct gui_state *g, struct player *p) {
sp.st = &set[i];

if(S_isEnabled(sp.st, p)) {
if(!G_ScrollOcclude(g, &CBIState(g)->settingscr, sp.y, 10))
if(!G_ScrOcc(g, &CBIState(g)->settingscr, sp.y, 10))
sp.st->cb(&sp);

sp.y += 10;
}
}

G_ScrollEnd(g, &CBIState(g)->settingscr);
G_ScrEnd(g, &CBIState(g)->settingscr);
}

/* EOF */

+ 17
- 19
source/p_shop.c Zobrazit soubor

@@ -27,24 +27,22 @@ struct shopitem

/* Static Objects ---------------------------------------------------------- */

StrEntON
static struct shopitem shopitems[] = {
/* {{"Name-----------", "BIP------------", Cost---}, Class, Cnt-, "Class---------------", [Flags]}, */
{{"RocketAmmo", snil, 9000}, gA, 5, OBJ "RocketAmmo"},
{{"PlasmaAmmo", snil, 75750}, gA, 1000, OBJ "PlasmaAmmo"},
{{"ChargeFist", "ChargeFist", 100000}, pM, 1, OBJ "ChargeFist", true},
{{"Revolver", "Revolver", 500000}, pM, 1, OBJ "Revolver", true},
{{"LazShotgun", "LazShotgun", 1800000}, pM, 1, OBJ "LazShotgun", true},
{{"SniperRifle", "SniperRifle", 1800000}, pM, 1, OBJ "SniperRifle", true},
{{"MissileLauncher", "MissileLauncher", 2500000}, gO, 1, OBJ "MissileLauncher", true},
{{"PlasmaDiffuser", "PlasmaDiffuser", 2500000}, gO, 1, OBJ "PlasmaDiffuser", true},
{{"Allmap", snil, 100000}, gA, 1, "Allmap"},
{{"Infrared", snil, 70000}, gA, 1, "Infrared"},
{{"RadSuit", snil, 100000}, gA, 1, "RadSuit"},
{{s"RocketAmmo", snil, 9000}, gA, 5, sOBJ "RocketAmmo"},
{{s"PlasmaAmmo", snil, 75750}, gA, 1000, sOBJ "PlasmaAmmo"},
{{s"ChargeFist", s"ChargeFist", 100000}, pM, 1, sOBJ "ChargeFist", true},
{{s"Revolver", s"Revolver", 500000}, pM, 1, sOBJ "Revolver", true},
{{s"LazShotgun", s"LazShotgun", 1800000}, pM, 1, sOBJ "LazShotgun", true},
{{s"SniperRifle", s"SniperRifle", 1800000}, pM, 1, sOBJ "SniperRifle", true},
{{s"MissileLauncher", s"MissileLauncher", 2500000}, gO, 1, sOBJ "MissileLauncher", true},
{{s"PlasmaDiffuser", s"PlasmaDiffuser", 2500000}, gO, 1, sOBJ "PlasmaDiffuser", true},
{{s"Allmap", snil, 100000}, gA, 1, s"Allmap"},
{{s"Infrared", snil, 70000}, gA, 1, s"Infrared"},
{{s"RadSuit", snil, 100000}, gA, 1, s"RadSuit"},
};
StrEntOFF

/* Static Functions -------------------------------------------------------- */

@@ -97,23 +95,23 @@ void P_CBI_TabShop(struct gui_state *g, struct player *p)
nitems++;
}

G_ScrollBegin(g, &CBIState(g)->shopscr, 15, 36, gui_p.btnlist.w, 186, gui_p.btnlist.h * nitems);
G_ScrBeg(g, &CBIState(g)->shopscr, 15, 36, gui_p.btnlist.w, 186, gui_p.btnlist.h * nitems);

for(i32 i = 0, y = 0; i < countof(shopitems); i++)
{
if(G_ScrollOcclude(g, &CBIState(g)->shopscr, y, gui_p.btnlistsel.h) || !(shopitems[i].pclass & p->pclass))
if(G_ScrOcc(g, &CBIState(g)->shopscr, y, gui_p.btnlistsel.h) || !(shopitems[i].pclass & p->pclass))
continue;

cstr name = LanguageC(LANG "SHOP_TITLE_%S", shopitems[i].name);

i32 *shopsel = &CBIState(g)->shopsel;
if(G_Button_Id(g, i, name, 0, y, i == *shopsel, Pre(btnlistsel)))
if(G_Button_HId(g, i, name, 0, y, i == *shopsel, Pre(btnlistsel)))
*shopsel = i;

y += gui_p.btnlistsel.h;
}

G_ScrollEnd(g, &CBIState(g)->shopscr);
G_ScrEnd(g, &CBIState(g)->shopscr);

struct shopitem *item = &shopitems[CBIState(g)->shopsel];



+ 2
- 2
source/p_weapons.c Zobrazit soubor

@@ -198,7 +198,7 @@ void P_Wep_PTick(struct player *p)
ServCallI(sm_DelearSprite);
break;
case weapon_cfist:
__with(k64 charge = 5 + InvNum(so_FistCharge) / 10.lk;)
__with(k64 charge = 5 + InvNum(so_FistCharge) / 10.0lk;)
{
PrintTextFmt(LC(LANG "CHARGE_FMT"), charge);
PrintText(s_smallfnt, CR_LIGHTBLUE, 270,2, 200,2);
@@ -389,7 +389,7 @@ void Sc_PoisonFXTicker(void)
script_str ext("ACS") addr(OBJ "RecoilUp")
void Sc_RecoilUp(k32 amount)
{
with_player(LocalPlayer) p->extrpitch += amount / 180.lk;
with_player(LocalPlayer) p->extrpitch += amount / 180.0lk;
}

/* EOF */

+ 1
- 1
source/u_headsupdisd.c Zobrazit soubor

@@ -81,7 +81,7 @@ static void HUD_Health(struct player *p) {
i32 xx = x - i;
if(xx < 0) xx += 40;

PrintSpriteA(gfx, 21+xx,1, 220,1, (20 - i) / 20.);
PrintSpriteA(gfx, 21+xx,1, 220,1, (20 - i) / 20.0);
}
}



+ 0
- 1
source/u_magic.c Zobrazit soubor

@@ -128,7 +128,6 @@ static void SetMagicUI(struct player *p, bool on)
script
void Upgr_Magic_Update(struct player *p, struct upgrade *upgr)
{
StrEntON
k32 manaperc = p->mana / (k32)p->manamax;

if(UData.manaperc < 1 && manaperc == 1)


+ 1
- 1
source/w_monster.c Zobrazit soubor

@@ -289,7 +289,7 @@ static void MonsterMain(dmon_t *m)
}

if(HasResistances(m) && m->level >= 20)
ShowBarrier(m, m->level / 100.);
ShowBarrier(m, m->level / 100.0);

if(InvNum(so_Ionized) && tic % 5 == 0)
ServCallI(sm_IonizeFX);


+ 1
- 3
tools/monc.rb Zobrazit soubor

@@ -122,12 +122,11 @@ res
}
};

StrEntON
static struct monster_info const monsterinfo[] = {
#{
res = String.new
for mon in monsters
res.concat %( {#{mon[:exp]}, #{mon[:scr]}, mtype_#{mon[:mtype]}, "#{mon[:match]}")
res.concat %( {#{mon[:exp]}, #{mon[:scr]}, mtype_#{mon[:mtype]}, s"#{mon[:match]}")
unless mon[:flags].empty?
res.concat ", " + mon[:flags].join("|")
end
@@ -136,7 +135,6 @@ end
res
}
};
StrEntOFF

/* EOF */
_end_


+ 2
- 6
tools/upgc.rb Zobrazit soubor

@@ -73,7 +73,7 @@ common_main do
una = tok.text

tok = tks.next.expect_after tok, :identi
inf = if tok.text == "N/A" then "0" else '"' + tok.text + '"' end
inf = if tok.text == "N/A" then "snil" else 's"' + tok.text + '"' end

scr = tks.peek_or :number, "0"

@@ -146,20 +146,16 @@ _end_h_

/* Extern Objects ---------------------------------------------------------- */

StrEntON

struct upgradeinfo upgrinfo[UPGR_MAX] = {
#{
res = String.new
for una, upg in upgrades
res.concat %( {{"#{una}", #{upg[:inf]}, #{upg[:scr]}}, #{upg[:pcl]}, #{upg[:cat]}, #{upg[:prf]}, #{upg[:grp]}, #{upg[:req]}, #{upg[:mul]}, UPGR_#{una}},\n)
res.concat %( {{s"#{una}", #{upg[:inf]}, #{upg[:scr]}}, #{upg[:pcl]}, #{upg[:cat]}, #{upg[:prf]}, #{upg[:grp]}, #{upg[:req]}, #{upg[:mul]}, UPGR_#{una}},\n)
end
res
}
};

StrEntOFF

i32 Upgr_StrToEnum(cstr s) {
u32 fst = FourCCPtr(s + 0);
u32 snd = FourCCPtr(s + 4);


+ 7
- 11
tools/wepc.rb Zobrazit soubor

@@ -123,17 +123,15 @@ _end_h_

/* Extern Objects ---------------------------------------------------------- */

StrEntON

#define Placeholder1 "MMMMHMHMMMHMMM"
#define Placeholder2 "YOUSONOFABITCH"
#define A(a) OBJ a "Ammo"
#define O(a) OBJ a
#define P(a) "weapons/" a "/pickup"
#define N(a) .classname = OBJ a, .name = a
#define Placeholder1 s"MMMMHMHMMMHMMM"
#define Placeholder2 s"YOUSONOFABITCH"
#define A(a) sOBJ a "Ammo"
#define O(a) sOBJ a
#define P(a) s"weapons/" a "/pickup"
#define N(a) .classname = sOBJ a, .name = Spf a
#define F(...) .flags = __VA_ARGS__
struct weaponinfo const weaponinfo[weapon_max] = {
{0, pcl_any, snil, "MMMMHMHMMMHMMM"},
{0, pcl_any, snil, Placeholder1},
#{
res = String.new
weps.each do |wep|
@@ -143,8 +141,6 @@ res
}
};

StrEntOFF

/* Extern Functions -------------------------------------------------------- */

cstr P_Wep_GetPickup(i32 n) {


Načítá se…
Zrušit
Uložit