Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 21-installer-nodd
  • 2210-pre1
  • 2210-pre2
  • 2210-rc1
  • 2210-rc2
  • 2210-rc3
  • 2211-pre1
  • 2211-pre2
  • 2211-rc1
  • 2212-pre1
  • 2212-pre2
  • 2212-pre3
  • 2212-rc1
  • 2213
  • 2214-pre1
  • 2214-pre2
  • 2214-pre3
  • 2214-pre4
  • 2_2_12
  • 64-gl-log
  • COM_ImmedExecute-lua
  • DJGPP
  • accel-momentum
  • acs
  • action-args
  • alpha-fixes
  • any-resolution
  • appveyor
  • better-distance-math
  • blend-locking
  • blentran
  • blua-unary-not-fix
  • boost-tickrate
  • bustablesoundz
  • cleanup-opengl
  • cleanupmusic
  • clipmidtex
  • cmake-valgrind
  • crawlacommander-sprites
  • custom-map-names
  • custom-teams
  • cutscene-cleanup
  • dd-music-bypass
  • dd-music-fix
  • delfile2
  • deprecate-lua-dedicated-server
  • dpl-2
  • dropshadows-spawning
  • dynabsp
  • emblem-drawing
  • exchndl-xp-fix
  • extra-textures
  • few-kart-lua-changes
  • ffloorclip
  • fix-167
  • fix-cvar-conflicts
  • fix-opengl-parameter-crash
  • fix-opengl-shear-roll
  • flipfuncpointers
  • fof-lightlist-fixes
  • font-FUCK
  • frictionrefactor
  • fuck-macros-1
  • gamepad-luakeydown
  • gamepad-morefixes
  • gamepad_experiments
  • gametype-refactor
  • gametype-refactor-1
  • gametype-refactor-player-spawns
  • ghost-networking
  • gif-splitting
  • grr-lj
  • hitboxviewer
  • hwr-texture-cache-refactor
  • hwrender2
  • improve-439
  • increase-maxconditionsets
  • increase-packet-tics
  • input-display
  • input-display-translucency
  • io
  • joystick-juggling-maz
  • just-in-case
  • keycodes-only
  • ksf-wadfiles
  • ld413-mp-fix
  • levelstruct
  • libpng-version-support
  • linedef-actions
  • lj-test
  • lol-states
  • loopedsounds
  • lower-unpegged-fix
  • lua-change-gametype
  • lua-command-netids
  • lua-gfx-2
  • lua-gfx-sprites
  • lua-local
  • makefile-auto-mingw-gcc
  • makefile-tinkering
  • SRB2_release_2.1
  • SRB2_release_2.1.1
  • SRB2_release_2.1.10
  • SRB2_release_2.1.11
  • SRB2_release_2.1.12
  • SRB2_release_2.1.14
  • SRB2_release_2.1.15
  • SRB2_release_2.1.16
  • SRB2_release_2.1.16a
  • SRB2_release_2.1.17
  • SRB2_release_2.1.18
  • SRB2_release_2.1.19
  • SRB2_release_2.1.2
  • SRB2_release_2.1.20
  • SRB2_release_2.1.21
  • SRB2_release_2.1.22
  • SRB2_release_2.1.23
  • SRB2_release_2.1.24
  • SRB2_release_2.1.25
  • SRB2_release_2.1.3
  • SRB2_release_2.1.4
  • SRB2_release_2.1.5
  • SRB2_release_2.1.6
  • SRB2_release_2.1.7
  • SRB2_release_2.1.8
  • SRB2_release_2.1.9
  • SRB2_release_2.2.0
  • SRB2_release_2.2.1
  • SRB2_release_2.2.10
  • SRB2_release_2.2.11
  • SRB2_release_2.2.12
  • SRB2_release_2.2.13
  • SRB2_release_2.2.15
  • SRB2_release_2.2.2
  • SRB2_release_2.2.3
  • SRB2_release_2.2.4
  • SRB2_release_2.2.5
  • SRB2_release_2.2.6
  • SRB2_release_2.2.7
  • SRB2_release_2.2.8
  • SRB2_release_2.2.9
  • td-release-v1.0.0
142 results

Target

Select target project
  • STJr/SRB2
  • Sryder/SRB2
  • wolfy852/SRB2
  • Alpha2244/SRB2
  • Inuyasha/SRB2
  • yoshibot/SRB2
  • TehRealSalt/SRB2
  • PrisimaTF/SRB2
  • Hatninja/SRB2
  • SteelT/SRB2
  • james/SRB2
  • ShaderWraith/SRB2
  • SinnamonLat/SRB2
  • mazmazz_/SRB2
  • filpAM/SRB2
  • chaoloveicemdboy/SRB2
  • Whooa21/SRB2
  • Machturne/SRB2
  • Golden/SRB2
  • Tatsuru/SRB2
  • Snu/SRB2
  • Zwip-Zwap_Zapony/SRB2
  • fickleheart/SRB2
  • alphaRexJames/SRB2
  • JJK/SRB2
  • diskpoppy/SRB2
  • Hannu_Hanhi/SRB2
  • ZipperQR/SRB2
  • kays/SRB2
  • spherallic/SRB2
  • Zippy_Zolton/SRB2
  • namiishere/SRB2
  • Ors/SRB2
  • SMS_Alfredo/SRB2
  • sonic_edge/SRB2
  • lavla/SRB2
  • ashi/SRB2
  • X.organic/SRB2
  • Fafabis/SRB2
  • Meziu/SRB2
  • v-rob/SRB2
  • tertu/SRB2
  • bitten2up/SRB2
  • flarn2006/SRB2
  • Krabs/SRB2
  • clairebun/SRB2
  • Lactozilla/SRB2
  • thehackstack/SRB2
  • Spice/SRB2
  • win8linux/SRB2
  • JohnFrostFox/SRB2
  • talktoneon726/SRB2
  • Wane/SRB2
  • Lamibe/SRB2
  • spectrumuk2/srb-2
  • nerdyminer18/srb-2
  • 256nil/SRB2
  • ARJr/SRB2
  • Alam/SRB2
  • Zenya/srb-2-marathon-demos
  • Acelite/srb-2-archivedmodifications
  • MIDIMan/SRB2
  • Lach/SRB2
  • Frostiikin/bounce-tweaks
  • Jaden/SRB2
  • Tyron/SRB2
  • Astronight/SRB2
  • Mari0shi06/SRB2
  • aiire/SRB2
  • Galactice/SRB2
  • srb2-ports/srb2-dreamcast
  • sdasdas/SRB2
  • chreas/srb-2-vr
  • StarManiaKG/the-story-of-sinically-rocketing-and-botching-the-2nd
  • LoganAir/SRB2
  • NepDisk/srb-2
  • alufolie91/SRB2
  • Felicia.iso/SRB2
  • twi/SRB2
  • BarrelsOFun/SRB2
  • Speed2411/SRB2
  • Leather_Realms/SRB2
  • Ayemar/SRB2
  • Acelite/SRB2
  • VladDoc/SRB2
  • kaldrum/model-features
  • strawberryfox417/SRB2
  • Lugent/SRB2
  • Rem/SRB2
  • Refrag/SRB2
  • Henry_3230/srb-3230
  • TehPuertoRicanSpartan2/tprs-srb2
  • Leminn/srb-2-marathon-stuff
  • chromaticpipe2/SRB2
  • MiguelGustavo15/SRB2
  • Maru/srb-2-tests
  • SilicDev/SRB2
  • UnmatchedBracket/SRB2
  • HybridDog/SRB2
  • xordspar0/SRB2
  • jsjhbewfhh/SRB2
  • Fancy2209/SRB2
  • Lorsoen/SRB2
  • shindoukin/SRB2
  • GamerOfDays/SRB2
  • Craftyawesome/SRB2
  • tenshi-tensai-tennoji/SRB2
  • Scarfdudebalder/SRB2
  • luigi-budd/srb-2-fix-interplag-lockon
  • mskluesner/SRB2
  • johnpetersa19/SRB2
  • Pheazant/SRB2
  • chromaticpipe2/srb2classic
  • romoney5/SRB2
  • PAS/SRB2Classic
  • BlueStaggo/SRB2
  • Jisk/srb-2-beef-jerky
  • voltybystorm/SRB2
  • ZenithNeko/srb-2-xp
  • Nep2Disk/SRB2
  • Cloudeon/SRB2
121 results
Select Git revision
Show changes
Showing with 4079 additions and 3281 deletions
...@@ -1429,7 +1429,7 @@ static void HWR_SearchLightsInMobjs(void) ...@@ -1429,7 +1429,7 @@ static void HWR_SearchLightsInMobjs(void)
// search in the list of thinkers // search in the list of thinkers
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed) if (th->function != (actionf_p1)P_RemoveThinkerDelayed)
HWR_AddMobjLights((mobj_t *)th); HWR_AddMobjLights((mobj_t *)th);
} }
#endif #endif
......
...@@ -2671,45 +2671,31 @@ fixed_t *hwbbox; ...@@ -2671,45 +2671,31 @@ fixed_t *hwbbox;
static void HWR_RenderBSPNode(INT32 bspnum) static void HWR_RenderBSPNode(INT32 bspnum)
{ {
node_t *bsp = &nodes[bspnum]; bspnode_t *bsp;
// Decide which side the view point is on
INT32 side; INT32 side;
ps_numbspcalls.value.i++; ps_numbspcalls.value.i++;
// Found a subsector? while (!(bspnum & NF_SUBSECTOR)) // Found a subsector?
if (bspnum & NF_SUBSECTOR)
{
if (bspnum == -1)
{
//*(gl_drawsubsector_p++) = 0;
HWR_Subsector(0);
}
else
{ {
//*(gl_drawsubsector_p++) = bspnum&(~NF_SUBSECTOR); bsp = &nodes[bspnum];
HWR_Subsector(bspnum&(~NF_SUBSECTOR));
}
return;
}
// Decide which side the view point is on. // Decide which side the view point is on.
side = R_PointOnSide(viewx, viewy, bsp); side = R_PointOnSide(viewx, viewy, bsp);
// BP: big hack for a test in lighning ref : 1249753487AB // BP: big hack for a test in lighning ref : 1249753487AB
hwbbox = bsp->bbox[side]; hwbbox = bsp->bbox[side];
// Recursively divide front space. // Recursively divide front space.
HWR_RenderBSPNode(bsp->children[side]); HWR_RenderBSPNode(bsp->children[side]);
// Possibly divide back space. // Possibly divide back space.
if (HWR_CheckBBox(bsp->bbox[side^1]))
{ if (!HWR_CheckBBox(bsp->bbox[side^1]))
// BP: big hack for a test in lighning ref : 1249753487AB return;
hwbbox = bsp->bbox[side^1];
HWR_RenderBSPNode(bsp->children[side^1]); bspnum = bsp->children[side^1];
} }
HWR_Subsector(bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR);
} }
// ========================================================================== // ==========================================================================
...@@ -3182,7 +3168,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) ...@@ -3182,7 +3168,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
if (h <= temp) if (h <= temp)
{ {
if (!lightset) if (!lightset)
lightlevel = *list[i-1].lightlevel > 255 ? 255 : *list[i-1].lightlevel; lightlevel = max(min(*list[i-1].lightlevel, 255), 0);
if (!(spr->mobj->renderflags & RF_NOCOLORMAPS)) if (!(spr->mobj->renderflags & RF_NOCOLORMAPS))
colormap = *list[i-1].extra_colormap; colormap = *list[i-1].extra_colormap;
break; break;
...@@ -3201,7 +3187,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) ...@@ -3201,7 +3187,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr)
if (!(list[i].flags & FOF_NOSHADE) && (list[i].flags & FOF_CUTSPRITES)) if (!(list[i].flags & FOF_NOSHADE) && (list[i].flags & FOF_CUTSPRITES))
{ {
if (!lightset) if (!lightset)
lightlevel = *list[i].lightlevel > 255 ? 255 : *list[i].lightlevel; lightlevel = max(min(*list[i].lightlevel, 255), 0);
if (!(spr->mobj->renderflags & RF_NOCOLORMAPS)) if (!(spr->mobj->renderflags & RF_NOCOLORMAPS))
colormap = *list[i].extra_colormap; colormap = *list[i].extra_colormap;
} }
...@@ -3582,13 +3568,13 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) ...@@ -3582,13 +3568,13 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
INT32 light = R_GetPlaneLight(sector, spr->mobj->z, false); INT32 light = R_GetPlaneLight(sector, spr->mobj->z, false);
if (!lightset) if (!lightset)
lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel; lightlevel = max(min(*sector->lightlist[light].lightlevel, 255), 0);
if (*sector->lightlist[light].extra_colormap && !(spr->mobj->renderflags & RF_NOCOLORMAPS)) if (*sector->lightlist[light].extra_colormap && !(spr->mobj->renderflags & RF_NOCOLORMAPS))
colormap = *sector->lightlist[light].extra_colormap; colormap = *sector->lightlist[light].extra_colormap;
} }
else if (!lightset) else if (!lightset)
lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel; lightlevel = max(min(sector->lightlevel, 255), 0);
if (R_ThingIsSemiBright(spr->mobj)) if (R_ThingIsSemiBright(spr->mobj))
lightlevel = 128 + (lightlevel>>1); lightlevel = 128 + (lightlevel>>1);
...@@ -5675,7 +5661,6 @@ void HWR_LoadLevel(void) ...@@ -5675,7 +5661,6 @@ void HWR_LoadLevel(void)
// ========================================================================== // ==========================================================================
static CV_PossibleValue_t glshaders_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Ignore custom shaders"}, {0, NULL}}; static CV_PossibleValue_t glshaders_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Ignore custom shaders"}, {0, NULL}};
static CV_PossibleValue_t glmodelinterpolation_cons_t[] = {{0, "Off"}, {1, "Sometimes"}, {2, "Always"}, {0, NULL}};
static CV_PossibleValue_t glfakecontrast_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Smooth"}, {0, NULL}}; static CV_PossibleValue_t glfakecontrast_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Smooth"}, {0, NULL}};
static CV_PossibleValue_t glshearing_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Third-person"}, {0, NULL}}; static CV_PossibleValue_t glshearing_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Third-person"}, {0, NULL}};
...@@ -5704,7 +5689,7 @@ consvar_t cv_glcoronasize = CVAR_INIT ("gr_coronasize", "1", CV_SAVE|CV_FLOAT, 0 ...@@ -5704,7 +5689,7 @@ consvar_t cv_glcoronasize = CVAR_INIT ("gr_coronasize", "1", CV_SAVE|CV_FLOAT, 0
#endif #endif
consvar_t cv_glmodels = CVAR_INIT ("gr_models", "Off", CV_SAVE, CV_OnOff, NULL); consvar_t cv_glmodels = CVAR_INIT ("gr_models", "Off", CV_SAVE, CV_OnOff, NULL);
consvar_t cv_glmodelinterpolation = CVAR_INIT ("gr_modelinterpolation", "Sometimes", CV_SAVE, glmodelinterpolation_cons_t, NULL); consvar_t cv_glmodelinterpolation = CVAR_INIT ("gr_modelinterpolation", "On", CV_SAVE, CV_OnOff, NULL);
consvar_t cv_glmodellighting = CVAR_INIT ("gr_modellighting", "Off", CV_SAVE|CV_CALL, CV_OnOff, CV_glmodellighting_OnChange); consvar_t cv_glmodellighting = CVAR_INIT ("gr_modellighting", "Off", CV_SAVE|CV_CALL, CV_OnOff, CV_glmodellighting_OnChange);
consvar_t cv_glshearing = CVAR_INIT ("gr_shearing", "Off", CV_SAVE, glshearing_cons_t, NULL); consvar_t cv_glshearing = CVAR_INIT ("gr_shearing", "Off", CV_SAVE, glshearing_cons_t, NULL);
......
...@@ -43,6 +43,7 @@ void HWR_MakePatch(const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipma ...@@ -43,6 +43,7 @@ void HWR_MakePatch(const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipma
void HWR_CreatePlanePolygons(INT32 bspnum); void HWR_CreatePlanePolygons(INT32 bspnum);
void HWR_CreateStaticLightmaps(INT32 bspnum); void HWR_CreateStaticLightmaps(INT32 bspnum);
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color); void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color);
void HWR_DrawFixedFill(fixed_t x, fixed_t y, fixed_t w, fixed_t h, INT32 color);
void HWR_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT16 actualcolor, UINT8 strength); void HWR_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT16 actualcolor, UINT8 strength);
void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT32 actualcolor); // Lat: separate flags from color since color needs to be an uint to work right. void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT32 actualcolor); // Lat: separate flags from color since color needs to be an uint to work right.
......
...@@ -1062,15 +1062,11 @@ static boolean HWR_AllowModel(mobj_t *mobj) ...@@ -1062,15 +1062,11 @@ static boolean HWR_AllowModel(mobj_t *mobj)
static boolean HWR_CanInterpolateModel(mobj_t *mobj, model_t *model) static boolean HWR_CanInterpolateModel(mobj_t *mobj, model_t *model)
{ {
if (cv_glmodelinterpolation.value == 2) // Always interpolate
return true;
return model->interpolate[(mobj->frame & FF_FRAMEMASK)]; return model->interpolate[(mobj->frame & FF_FRAMEMASK)];
} }
static boolean HWR_CanInterpolateSprite2(modelspr2frames_t *spr2frame) static boolean HWR_CanInterpolateSprite2(modelspr2frames_t *spr2frame)
{ {
if (cv_glmodelinterpolation.value == 2) // Always interpolate
return true;
return spr2frame->interpolate; return spr2frame->interpolate;
} }
...@@ -1323,7 +1319,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) ...@@ -1323,7 +1319,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
else if (R_ThingIsSemiBright(spr->mobj)) else if (R_ThingIsSemiBright(spr->mobj))
lightlevel = 128 + (*sector->lightlist[light].lightlevel>>1); lightlevel = 128 + (*sector->lightlist[light].lightlevel>>1);
else if (!R_ThingIsFullBright(spr->mobj)) else if (!R_ThingIsFullBright(spr->mobj))
lightlevel = *sector->lightlist[light].lightlevel > 255 ? 255 : *sector->lightlist[light].lightlevel; lightlevel = max(min(255, *sector->lightlist[light].lightlevel), 0);
if (*sector->lightlist[light].extra_colormap) if (*sector->lightlist[light].extra_colormap)
colormap = *sector->lightlist[light].extra_colormap; colormap = *sector->lightlist[light].extra_colormap;
...@@ -1335,7 +1331,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) ...@@ -1335,7 +1331,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
else if (R_ThingIsSemiBright(spr->mobj)) else if (R_ThingIsSemiBright(spr->mobj))
lightlevel = 128 + (sector->lightlevel>>1); lightlevel = 128 + (sector->lightlevel>>1);
else if (!R_ThingIsFullBright(spr->mobj)) else if (!R_ThingIsFullBright(spr->mobj))
lightlevel = sector->lightlevel > 255 ? 255 : sector->lightlevel; lightlevel = max(min(255, sector->lightlevel), 0);
if (sector->extra_colormap) if (sector->extra_colormap)
colormap = sector->extra_colormap; colormap = sector->extra_colormap;
......
...@@ -155,23 +155,24 @@ static const GLfloat byte2float[256] = { ...@@ -155,23 +155,24 @@ static const GLfloat byte2float[256] = {
// -----------------+ // -----------------+
#ifdef DEBUG_TO_FILE #ifdef DEBUG_TO_FILE
FILE *gllogstream; FILE *gllogstream = NULL;
#endif #endif
FUNCPRINTF void GL_DBG_Printf(const char *format, ...) FUNCPRINTF void GL_DBG_Printf(const char *format, ...)
{ {
#ifdef DEBUG_TO_FILE #ifdef DEBUG_TO_FILE
char str[4096] = ""; char str[4096] = "";
va_list arglist; va_list arglist;
if (!gllogstream) if (gllogstream)
gllogstream = fopen("ogllog.txt", "w"); {
va_start(arglist, format); va_start(arglist, format);
vsnprintf(str, 4096, format, arglist); vsnprintf(str, 4096, format, arglist);
va_end(arglist); va_end(arglist);
fwrite(str, strlen(str), 1, gllogstream); fwrite(str, strlen(str), 1, gllogstream);
}
#else #else
(void)format; (void)format;
#endif #endif
...@@ -227,7 +228,6 @@ FUNCPRINTF static void GL_MSG_Error(const char *format, ...) ...@@ -227,7 +228,6 @@ FUNCPRINTF static void GL_MSG_Error(const char *format, ...)
/* 1.0 functions */ /* 1.0 functions */
/* Miscellaneous */ /* Miscellaneous */
#define pglClearColor glClearColor #define pglClearColor glClearColor
//glClear
#define pglColorMask glColorMask #define pglColorMask glColorMask
#define pglAlphaFunc glAlphaFunc #define pglAlphaFunc glAlphaFunc
#define pglBlendFunc glBlendFunc #define pglBlendFunc glBlendFunc
...@@ -237,9 +237,7 @@ FUNCPRINTF static void GL_MSG_Error(const char *format, ...) ...@@ -237,9 +237,7 @@ FUNCPRINTF static void GL_MSG_Error(const char *format, ...)
#define pglEnable glEnable #define pglEnable glEnable
#define pglDisable glDisable #define pglDisable glDisable
#define pglGetFloatv glGetFloatv #define pglGetFloatv glGetFloatv
//glGetIntegerv #define pglPolygonMode glPolygonMode
//glGetString
#define pglHint glHint
/* Depth Buffer */ /* Depth Buffer */
#define pglClearDepth glClearDepth #define pglClearDepth glClearDepth
...@@ -283,6 +281,7 @@ FUNCPRINTF static void GL_MSG_Error(const char *format, ...) ...@@ -283,6 +281,7 @@ FUNCPRINTF static void GL_MSG_Error(const char *format, ...)
/* Texture mapping */ /* Texture mapping */
#define pglTexEnvi glTexEnvi #define pglTexEnvi glTexEnvi
#define pglTexParameteri glTexParameteri #define pglTexParameteri glTexParameteri
#define pglTexImage1D glTexImage1D
#define pglTexImage2D glTexImage2D #define pglTexImage2D glTexImage2D
#define pglTexSubImage2D glTexSubImage2D #define pglTexSubImage2D glTexSubImage2D
...@@ -668,6 +667,7 @@ void SetupGLFunc4(void) ...@@ -668,6 +667,7 @@ void SetupGLFunc4(void)
{ {
/* 1.2 funcs */ /* 1.2 funcs */
pglTexImage3D = GetGLFunc("glTexImage3D"); pglTexImage3D = GetGLFunc("glTexImage3D");
/* 1.3 funcs */ /* 1.3 funcs */
pglActiveTexture = GetGLFunc("glActiveTexture"); pglActiveTexture = GetGLFunc("glActiveTexture");
pglMultiTexCoord2f = GetGLFunc("glMultiTexCoord2f"); pglMultiTexCoord2f = GetGLFunc("glMultiTexCoord2f");
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include "lua_hud.h" #include "lua_hud.h"
#include "lua_hudlib_drawlist.h" #include "lua_hudlib_drawlist.h"
#include "lua_hook.h" #include "lua_hook.h"
#include "lua_libs.h"
// coords are scaled // coords are scaled
#define HU_INPUTX 0 #define HU_INPUTX 0
...@@ -377,7 +378,7 @@ static void HU_removeChatText_Log(void) ...@@ -377,7 +378,7 @@ static void HU_removeChatText_Log(void)
void HU_AddChatText(const char *text, boolean playsound) void HU_AddChatText(const char *text, boolean playsound)
{ {
if (playsound && cv_consolechat.value != 2) // Don't play the sound if we're using hidden chat. if (playsound && cv_consolechat.value != 2) // Don't play the sound if we're using hidden chat.
S_StartSound(NULL, sfx_radio); S_StartSoundFromEverywhere(sfx_radio);
// reguardless of our preferences, put all of this in the chat buffer in case we decide to change from oldchat mid-game. // reguardless of our preferences, put all of this in the chat buffer in case we decide to change from oldchat mid-game.
if (chat_nummsg_log >= CHAT_BUFSIZE) // too many messages! if (chat_nummsg_log >= CHAT_BUFSIZE) // too many messages!
...@@ -396,7 +397,10 @@ void HU_AddChatText(const char *text, boolean playsound) ...@@ -396,7 +397,10 @@ void HU_AddChatText(const char *text, boolean playsound)
if (OLDCHAT) // if we're using oldchat, print directly in console if (OLDCHAT) // if we're using oldchat, print directly in console
CONS_Printf("%s\n", text); CONS_Printf("%s\n", text);
else // if we aren't, still save the message to log.txt else // if we aren't, still save the message to log.txt
CON_LogMessage(va("%s\n", text)); {
CON_LogMessage(text);
CON_LogMessage("\n"); // Add newline. Don't use va for that, since `text` might be refering to va's buffer itself
}
} }
/** Runs a say command, sending an ::XD_SAY message. /** Runs a say command, sending an ::XD_SAY message.
...@@ -1013,7 +1017,7 @@ static void HU_sendChatMessage(void) ...@@ -1013,7 +1017,7 @@ static void HU_sendChatMessage(void)
void HU_clearChatChars(void) void HU_clearChatChars(void)
{ {
memset(w_chat, '\0', sizeof(w_chat)); memset(w_chat, '\0', sizeof(w_chat));
I_SetTextInputMode(false); I_SetTextInputMode(textinputmodeenabledbylua);
chat_on = false; chat_on = false;
c_input = 0; c_input = 0;
...@@ -1150,7 +1154,7 @@ boolean HU_Responder(event_t *ev) ...@@ -1150,7 +1154,7 @@ boolean HU_Responder(event_t *ev)
if (!CHAT_MUTE) if (!CHAT_MUTE)
HU_sendChatMessage(); HU_sendChatMessage();
I_SetTextInputMode(false); I_SetTextInputMode(textinputmodeenabledbylua);
chat_on = false; chat_on = false;
c_input = 0; // reset input cursor c_input = 0; // reset input cursor
chat_scrollmedown = true; // you hit enter, so you might wanna autoscroll to see what you just sent. :) chat_scrollmedown = true; // you hit enter, so you might wanna autoscroll to see what you just sent. :)
...@@ -1161,7 +1165,7 @@ boolean HU_Responder(event_t *ev) ...@@ -1161,7 +1165,7 @@ boolean HU_Responder(event_t *ev)
|| c == gamecontrol[GC_TEAMKEY][0] || c == gamecontrol[GC_TEAMKEY][1]) || c == gamecontrol[GC_TEAMKEY][0] || c == gamecontrol[GC_TEAMKEY][1])
&& c >= KEY_MOUSE1)) // If it's not a keyboard key, then the chat button is used as a toggle. && c >= KEY_MOUSE1)) // If it's not a keyboard key, then the chat button is used as a toggle.
{ {
I_SetTextInputMode(false); I_SetTextInputMode(textinputmodeenabledbylua);
chat_on = false; chat_on = false;
c_input = 0; // reset input cursor c_input = 0; // reset input cursor
I_UpdateMouseGrab(); I_UpdateMouseGrab();
...@@ -1747,6 +1751,9 @@ static void HU_DrawDemoInfo(void) ...@@ -1747,6 +1751,9 @@ static void HU_DrawDemoInfo(void)
// Heads up displays drawer, call each frame // Heads up displays drawer, call each frame
// //
void HU_Drawer(void) void HU_Drawer(void)
{
if (LUA_HudEnabled(hud_chat))
{ {
// draw chat string plus cursor // draw chat string plus cursor
if (chat_on) if (chat_on)
...@@ -1764,8 +1771,9 @@ void HU_Drawer(void) ...@@ -1764,8 +1771,9 @@ void HU_Drawer(void)
if (!OLDCHAT && cv_consolechat.value < 2 && netgame) // Don't display minimized chat if you set the mode to Window (Hidden) if (!OLDCHAT && cv_consolechat.value < 2 && netgame) // Don't display minimized chat if you set the mode to Window (Hidden)
HU_drawMiniChat(); // draw messages in a cool fashion. HU_drawMiniChat(); // draw messages in a cool fashion.
} }
}
if (cechotimer) if (cechotimer && LUA_HudEnabled(hud_cecho))
HU_DrawCEcho(); HU_DrawCEcho();
if (demoplayback && hu_showscores) if (demoplayback && hu_showscores)
......
...@@ -9,20 +9,21 @@ ...@@ -9,20 +9,21 @@
/// \file i_threads.h /// \file i_threads.h
/// \brief Multithreading abstraction /// \brief Multithreading abstraction
#ifdef HAVE_THREADS
#ifndef I_THREADS_H #ifndef I_THREADS_H
#define I_THREADS_H #define I_THREADS_H
#include "doomtype.h"
typedef void (*I_thread_fn)(void *userdata); typedef void (*I_thread_fn)(void *userdata);
typedef void * I_mutex; typedef void * I_mutex;
typedef void * I_cond; typedef void * I_cond;
int I_can_thread (void) FUNCWARNRV;
void I_start_threads (void); void I_start_threads (void);
void I_stop_threads (void); void I_stop_threads (void);
void I_spawn_thread (const char *name, I_thread_fn, void *userdata); int I_spawn_thread (const char *name, I_thread_fn, void *userdata) FUNCWARNRV;
/* check in your thread whether to return early */ /* check in your thread whether to return early */
int I_thread_is_stopped (void); int I_thread_is_stopped (void);
...@@ -36,4 +37,3 @@ void I_wake_one_cond (I_cond *); ...@@ -36,4 +37,3 @@ void I_wake_one_cond (I_cond *);
void I_wake_all_cond (I_cond *); void I_wake_all_cond (I_cond *);
#endif/*I_THREADS_H*/ #endif/*I_THREADS_H*/
#endif/*HAVE_THREADS*/
This diff is collapsed.
This diff is collapsed.
...@@ -171,6 +171,8 @@ static const struct { ...@@ -171,6 +171,8 @@ static const struct {
{META_SKINCOLOR, "skincolor_t"}, {META_SKINCOLOR, "skincolor_t"},
{META_COLORRAMP, "skincolor_t.ramp"}, {META_COLORRAMP, "skincolor_t.ramp"},
{META_SPRITEINFO, "spriteinfo_t"}, {META_SPRITEINFO, "spriteinfo_t"},
{META_SPRITEINFOFRAMELIST,"spriteinfoframe_t[]"},
{META_SPRITEINFOFRAME,"spriteinfoframe_t"},
{META_PIVOTLIST, "spriteframepivot_t[]"}, {META_PIVOTLIST, "spriteframepivot_t[]"},
{META_FRAMEPIVOT, "spriteframepivot_t"}, {META_FRAMEPIVOT, "spriteframepivot_t"},
...@@ -189,6 +191,8 @@ static const struct { ...@@ -189,6 +191,8 @@ static const struct {
{META_SKINSPRITESLIST, "skin_t.skinsprites[]"}, {META_SKINSPRITESLIST, "skin_t.skinsprites[]"},
{META_SKINSPRITESCOMPAT, "skin_t.sprites"}, // TODO: 2.3: Delete {META_SKINSPRITESCOMPAT, "skin_t.sprites"}, // TODO: 2.3: Delete
{META_MUSICDEF, "musicdef_t"},
{META_VERTEX, "vertex_t"}, {META_VERTEX, "vertex_t"},
{META_LINE, "line_t"}, {META_LINE, "line_t"},
{META_SIDE, "side_t"}, {META_SIDE, "side_t"},
...@@ -238,7 +242,10 @@ static const struct { ...@@ -238,7 +242,10 @@ static const struct {
{META_LUABANKS, "luabanks[]"}, {META_LUABANKS, "luabanks[]"},
{META_KEYEVENT, "keyevent_t"}, {META_KEYEVENT, "keyevent_t"},
{META_TEXTEVENT, "textevent_t"},
{META_MOUSE, "mouse_t"}, {META_MOUSE, "mouse_t"},
{META_INTERCEPT, "intercept_t"},
{NULL, NULL} {NULL, NULL}
}; };
...@@ -3166,7 +3173,10 @@ static int lib_rCheckTextureNumForName(lua_State *L) ...@@ -3166,7 +3173,10 @@ static int lib_rCheckTextureNumForName(lua_State *L)
{ {
const char *name = luaL_checkstring(L, 1); const char *name = luaL_checkstring(L, 1);
//HUDSAFE //HUDSAFE
lua_pushinteger(L, R_CheckTextureNumForName(name)); INT32 num = R_CheckTextureNumForName(name, TEXTURETYPE_TEXTURE);
if (num == -1)
num = R_CheckTextureNumForName(name, TEXTURETYPE_FLAT);
lua_pushinteger(L, num);
return 1; return 1;
} }
...@@ -3254,10 +3264,10 @@ static int GetValidSoundOrigin(lua_State *L, void **origin) ...@@ -3254,10 +3264,10 @@ static int GetValidSoundOrigin(lua_State *L, void **origin)
return LUA_ErrInvalid(L, "sector_t"); return LUA_ErrInvalid(L, "sector_t");
*origin = &((sector_t *)(*origin))->soundorg; *origin = &((sector_t *)(*origin))->soundorg;
return 1; return 2;
} }
return LUA_ErrInvalid(L, "mobj_t/sector_t"); return 0;
} }
static int lib_sStartSound(lua_State *L) static int lib_sStartSound(lua_State *L)
...@@ -3276,15 +3286,23 @@ static int lib_sStartSound(lua_State *L) ...@@ -3276,15 +3286,23 @@ static int lib_sStartSound(lua_State *L)
if (!player) if (!player)
return LUA_ErrInvalid(L, "player_t"); return LUA_ErrInvalid(L, "player_t");
} }
if (!lua_isnil(L, 1)) if (player == NULL || P_IsLocalPlayer(player))
if (!GetValidSoundOrigin(L, &origin))
return 0;
if (!player || P_IsLocalPlayer(player))
{ {
if (hud_running || hook_cmd_running) if (lua_isnil(L, 1))
origin = NULL; // HUD rendering and CMD building startsound shouldn't have an origin, just remove it instead of having a retarded error. S_StartSoundFromEverywhere(sound_id);
else
S_StartSound(origin, sound_id); {
int origintype = GetValidSoundOrigin(L, &origin);
if (origintype == 1)
S_StartSoundFromMobj(origin, sound_id);
else if (origintype == 2)
{
origin = *((sector_t**)luaL_checkudata(L, 1, META_SECTOR)); // Restore this (other functions still use soundorg outright)
S_StartSoundFromSector(origin, sound_id);
}
else
return LUA_ErrInvalid(L, "mobj_t/sector_t");
}
} }
return 0; return 0;
} }
...@@ -3305,12 +3323,25 @@ static int lib_sStartSoundAtVolume(lua_State *L) ...@@ -3305,12 +3323,25 @@ static int lib_sStartSoundAtVolume(lua_State *L)
if (!player) if (!player)
return LUA_ErrInvalid(L, "player_t"); return LUA_ErrInvalid(L, "player_t");
} }
if (!lua_isnil(L, 1)) if (player == NULL || P_IsLocalPlayer(player))
if (!GetValidSoundOrigin(L, &origin)) {
if (lua_isnil(L, 1))
S_StartSoundFromEverywhereVol(sound_id, volume);
else
{
int origintype = GetValidSoundOrigin(L, &origin);
if (origintype == 1)
S_StartSoundFromMobjVol(origin, sound_id, volume);
else if (origintype == 2)
{
origin = *((sector_t**)luaL_checkudata(L, 1, META_SECTOR)); // Restore this (other functions still use soundorg outright)
S_StartSoundFromSectorVol(origin, sound_id, volume);
}
else
return LUA_ErrInvalid(L, "mobj_t/sector_t"); return LUA_ErrInvalid(L, "mobj_t/sector_t");
}
if (!player || P_IsLocalPlayer(player)) }
S_StartSoundAtVolume(origin, sound_id, volume);
return 0; return 0;
} }
...@@ -3735,6 +3766,73 @@ static int lib_sResumeMusic(lua_State *L) ...@@ -3735,6 +3766,73 @@ static int lib_sResumeMusic(lua_State *L)
return 1; return 1;
} }
enum musicdef_e
{
musicdef_name,
musicdef_title,
musicdef_alttitle,
musicdef_authors
};
static const char *const musicdef_opt[] = {
"name",
"title",
"alttitle",
"authors",
NULL,
};
static int musicdef_fields_ref = LUA_NOREF;
static int musicdef_get(lua_State *L)
{
musicdef_t *musicdef = *((musicdef_t **)luaL_checkudata(L, 1, META_MUSICDEF));
enum musicdef_e field = Lua_optoption(L, 2, -1, musicdef_fields_ref);
lua_settop(L, 2);
if (!musicdef)
return LUA_ErrInvalid(L, "musicdef_t");
switch (field)
{
case musicdef_name:
lua_pushstring(L, musicdef->name);
break;
case musicdef_title:
lua_pushstring(L, musicdef->title);
break;
case musicdef_alttitle:
lua_pushstring(L, musicdef->alttitle);
break;
case musicdef_authors:
lua_pushstring(L, musicdef->authors);
break;
default:
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
I_Assert(lua_istable(L, -1));
lua_pushlightuserdata(L, musicdef);
lua_rawget(L, -2);
if (!lua_istable(L, -1)) { // no extra values table
CONS_Debug(DBG_LUA, M_GetText("'%s' has no extvars table or field named '%s'; returning nil.\n"), "musicdef_t", lua_tostring(L, 2));
return 0;
}
lua_pushvalue(L, 2); // field name
lua_gettable(L, -2);
if (lua_isnil(L, -1)) // no value for this field
CONS_Debug(DBG_LUA, M_GetText("'%s' has no field named '%s'; returning nil.\n"), "musicdef_t", lua_tostring(L, 2));
break;
}
return 1;
}
static int lib_sMusicInfo(lua_State *L)
{
const char *music_name = lua_tolstring(L, 1, NULL);
LUA_PushUserdata(L, S_MusicInfo(music_name), META_MUSICDEF);
return 1;
}
// G_GAME // G_GAME
//////////// ////////////
...@@ -3877,6 +3975,34 @@ static int lib_gAddGametype(lua_State *L) ...@@ -3877,6 +3975,34 @@ static int lib_gAddGametype(lua_State *L)
return 0; return 0;
} }
// Lua exclusive function to unlock Lua Conditions
// Up to Lua scripter
static int lib_gUnlockCondition(lua_State* L)
{
int id = luaL_checkinteger(L, 1) - 1;
boolean global = luaL_checkboolean(L, 2);
if (id <= 0 || id > MAXLUACONDITIONS)
{
luaL_error(L, "Lua condition %d out of range (1 - %d)", id + 1, MAXLUACONDITIONS);
return 0;
}
if (global)
{
serverGamedata->lua[id] = true;
M_SilentUpdateUnlockablesAndEmblems(serverGamedata);
}
clientGamedata->lua[id] = true;
if (M_UpdateUnlockablesAndExtraEmblems(clientGamedata))
{
S_StartSoundFromEverywhere(sfx_s3k68);
}
return 0;
}
// Bot adding function! // Bot adding function!
// Partly lifted from Got_AddPlayer // Partly lifted from Got_AddPlayer
static int lib_gAddPlayer(lua_State *L) static int lib_gAddPlayer(lua_State *L)
...@@ -4176,16 +4302,21 @@ static int lib_gSetCustomExitVars(lua_State *L) ...@@ -4176,16 +4302,21 @@ static int lib_gSetCustomExitVars(lua_State *L)
// G_SetCustomExitVars(nil, int) [skipstats only] // G_SetCustomExitVars(nil, int) [skipstats only]
// G_SetCustomExitVars(int, int) [both of the above] // G_SetCustomExitVars(int, int) [both of the above]
// G_SetCustomExitVars(int, int, int) [nextmapoverride, skipstats and nextgametype] // G_SetCustomExitVars(int, int, int) [nextmapoverride, skipstats and nextgametype]
// G_SetCustomExitVars(int, int, int, int) [nextmapoverride, skipstats, nextgametype and keepcutscenes]
nextmapoverride = 0; nextmapoverride = 0;
skipstats = 0; skipstats = 0;
nextgametype = -1; nextgametype = -1;
keepcutscene = false;
if (n >= 1) if (n >= 1)
{ {
nextmapoverride = (INT16)luaL_optinteger(L, 1, 0); nextmapoverride = (INT16)luaL_optinteger(L, 1, 0);
skipstats = (INT16)luaL_optinteger(L, 2, 0); skipstats = (INT16)luaL_optinteger(L, 2, 0);
nextgametype = (INT16)luaL_optinteger(L, 3, -1); nextgametype = (INT16)luaL_optinteger(L, 3, -1);
if (!lua_isnil(L, 4))
keepcutscene = luaL_checkboolean(L, 4);
} }
return 0; return 0;
...@@ -4620,11 +4751,13 @@ static luaL_Reg lib[] = { ...@@ -4620,11 +4751,13 @@ static luaL_Reg lib[] = {
{"S_GetMusicLoopPoint",lib_sGetMusicLoopPoint}, {"S_GetMusicLoopPoint",lib_sGetMusicLoopPoint},
{"S_PauseMusic",lib_sPauseMusic}, {"S_PauseMusic",lib_sPauseMusic},
{"S_ResumeMusic", lib_sResumeMusic}, {"S_ResumeMusic", lib_sResumeMusic},
{"S_MusicInfo", lib_sMusicInfo},
// g_game // g_game
{"G_AddGametype", lib_gAddGametype}, {"G_AddGametype", lib_gAddGametype},
{"G_AddPlayer", lib_gAddPlayer}, {"G_AddPlayer", lib_gAddPlayer},
{"G_RemovePlayer", lib_gRemovePlayer}, {"G_RemovePlayer", lib_gRemovePlayer},
{"G_UnlockCondition", lib_gUnlockCondition},
{"G_SetUsedCheats", lib_gSetUsedCheats}, {"G_SetUsedCheats", lib_gSetUsedCheats},
{"G_BuildMapName",lib_gBuildMapName}, {"G_BuildMapName",lib_gBuildMapName},
{"G_BuildMapTitle",lib_gBuildMapTitle}, {"G_BuildMapTitle",lib_gBuildMapTitle},
...@@ -4658,6 +4791,11 @@ static luaL_Reg lib[] = { ...@@ -4658,6 +4791,11 @@ static luaL_Reg lib[] = {
int LUA_BaseLib(lua_State *L) int LUA_BaseLib(lua_State *L)
{ {
// musicdef_t
// Sound should have its whole own file for Lua, but this will do for now.
LUA_RegisterUserdataMetatable(L, META_MUSICDEF, musicdef_get, NULL, NULL);
musicdef_fields_ref = Lua_CreateFieldTable(L, musicdef_opt);
// Set metatable for string // Set metatable for string
lua_pushliteral(L, ""); // dummy string lua_pushliteral(L, ""); // dummy string
lua_getmetatable(L, -1); // get string metatable lua_getmetatable(L, -1); // get string metatable
......
...@@ -22,6 +22,11 @@ ...@@ -22,6 +22,11 @@
#include "lua_libs.h" #include "lua_libs.h"
#include "lua_hud.h" // hud_running errors #include "lua_hud.h" // hud_running errors
// Included for the custom options menu
#include "netcode/d_netfil.h"
#include "m_menu.h"
#include "w_wad.h"
// for functions not allowed in hud.add hooks // for functions not allowed in hud.add hooks
#define NOHUD if (hud_running)\ #define NOHUD if (hud_running)\
return luaL_error(L, "HUD rendering code should not call this function!"); return luaL_error(L, "HUD rendering code should not call this function!");
...@@ -508,7 +513,7 @@ static int lib_cvRegisterVar(lua_State *L) ...@@ -508,7 +513,7 @@ static int lib_cvRegisterVar(lua_State *L)
lua_pop(L, 1); lua_pop(L, 1);
cvar->func = Lua_OnChange; cvar->func = Lua_OnChange;
} }
else if (cvar->flags & CV_CALL && (k && fasticmp(k, "can_change"))) else if (cvar->flags & CV_CALL && (i == 6 || (k && fasticmp(k, "can_change"))))
{ {
if (!lua_isfunction(L, 4)) if (!lua_isfunction(L, 4))
{ {
...@@ -522,6 +527,29 @@ static int lib_cvRegisterVar(lua_State *L) ...@@ -522,6 +527,29 @@ static int lib_cvRegisterVar(lua_State *L)
lua_pop(L, 1); lua_pop(L, 1);
cvar->can_change = Lua_CanChange; cvar->can_change = Lua_CanChange;
} }
else if (((i == 5 && !(cvar->flags & CV_CALL))
|| (cvar->flags & CV_CALL && i == 7))
|| (k && fasticmp(k, "category")))
{
if (!lua_isstring(L, 4))
{
TYPEERROR("category", LUA_TSTRING)
}
cvar->category = Z_StrDup(lua_tostring(L, 4));
}
else if (((i == 6 && !(cvar->flags & CV_CALL))
|| (cvar->flags & CV_CALL && i == 8))
|| (k && fasticmp(k, "displayname")))
{
if (!lua_isstring(L, 4))
{
TYPEERROR("displayname", LUA_TSTRING)
}
cvar->displayname = Z_StrDup(lua_tostring(L, 4));
}
lua_pop(L, 1); lua_pop(L, 1);
} }
...@@ -548,6 +576,19 @@ static int lib_cvRegisterVar(lua_State *L) ...@@ -548,6 +576,19 @@ static int lib_cvRegisterVar(lua_State *L)
return luaL_error(L, M_GetText("Variable %s has CV_CALL without any callbacks"), cvar->name); return luaL_error(L, M_GetText("Variable %s has CV_CALL without any callbacks"), cvar->name);
} }
if (!cvar->displayname || cvar->displayname[0] == '\0')
{
cvar->displayname = cvar->name;
}
if (!cvar->category || cvar->category[0] == '\0')
{
char* temp = wadfiles[numwadfiles - 1]->filename;
temp += strlen(temp) - nameonlylength(temp);
cvar->category = temp;
}
cvar->flags |= CV_ALLOWLUA; cvar->flags |= CV_ALLOWLUA;
// actually time to register it to the console now! Finally! // actually time to register it to the console now! Finally!
cvar->flags |= CV_MODIFIED; cvar->flags |= CV_MODIFIED;
...@@ -558,6 +599,9 @@ static int lib_cvRegisterVar(lua_State *L) ...@@ -558,6 +599,9 @@ static int lib_cvRegisterVar(lua_State *L)
return luaL_error(L, "failed to register cvar (probable conflict with internal variable/command names)"); return luaL_error(L, "failed to register cvar (probable conflict with internal variable/command names)");
} }
if (cvar->flags & CV_MENU)
M_RegisterCustomCVOption(cvar);
// return cvar userdata // return cvar userdata
return 1; return 1;
} }
...@@ -672,6 +716,8 @@ enum cvar_e ...@@ -672,6 +716,8 @@ enum cvar_e
cvar_value, cvar_value,
cvar_string, cvar_string,
cvar_changed, cvar_changed,
cvar_displayname,
cvar_category,
}; };
static const char *const cvar_opt[] = { static const char *const cvar_opt[] = {
...@@ -681,6 +727,8 @@ static const char *const cvar_opt[] = { ...@@ -681,6 +727,8 @@ static const char *const cvar_opt[] = {
"value", "value",
"string", "string",
"changed", "changed",
"displayname",
"category",
NULL, NULL,
}; };
...@@ -711,6 +759,12 @@ static int cvar_get(lua_State *L) ...@@ -711,6 +759,12 @@ static int cvar_get(lua_State *L)
case cvar_changed: case cvar_changed:
lua_pushboolean(L, cvar->changed); lua_pushboolean(L, cvar->changed);
break; break;
case cvar_displayname:
lua_pushstring(L, cvar->displayname);
break;
case cvar_category:
lua_pushstring(L, cvar->category);
break;
default: default:
if (devparm) if (devparm)
return luaL_error(L, LUA_QL("consvar_t") " has no field named " LUA_QS ".", lua_tostring(L, 2)); return luaL_error(L, LUA_QL("consvar_t") " has no field named " LUA_QS ".", lua_tostring(L, 2));
......
...@@ -62,19 +62,24 @@ automatically. ...@@ -62,19 +62,24 @@ automatically.
X (ShieldSpecial),/* shield abilities */\ X (ShieldSpecial),/* shield abilities */\
X (PlayerCanDamage),/* P_PlayerCanDamage */\ X (PlayerCanDamage),/* P_PlayerCanDamage */\
X (PlayerQuit),\ X (PlayerQuit),\
X (NameChange),\
X (IntermissionThinker),/* Y_Ticker */\ X (IntermissionThinker),/* Y_Ticker */\
X (TeamSwitch),/* team switching in... uh... *what* speak, spit it the fuck out */\ X (TeamSwitch),/* team switching in... uh... *what* speak, spit it the fuck out */\
X (ViewpointSwitch),/* spy mode (no trickstabs) */\ X (ViewpointSwitch),/* spy mode (no trickstabs) */\
X (SeenPlayer),/* MT_NAMECHECK */\ X (SeenPlayer),/* MT_NAMECHECK */\
X (PlayerThink),/* P_PlayerThink */\ X (PlayerThink),/* P_PlayerThink */\
X (GameStart),\
X (GameQuit),\ X (GameQuit),\
X (GameEnd),\
X (PlayerCmd),/* building the player's ticcmd struct (Ported from SRB2Kart) */\ X (PlayerCmd),/* building the player's ticcmd struct (Ported from SRB2Kart) */\
X (MusicChange),\ X (MusicChange),\
X (SoundPlay),\
X (PlayerHeight),/* override player height */\ X (PlayerHeight),/* override player height */\
X (PlayerCanEnterSpinGaps),\ X (PlayerCanEnterSpinGaps),\
X (AddonLoaded),\ X (AddonLoaded),\
X (KeyDown),\ X (KeyDown),\
X (KeyUp),\ X (KeyUp),\
X (TextInput),\
#define STRING_HOOK_LIST(X) \ #define STRING_HOOK_LIST(X) \
X (BotAI),/* B_BuildTailsTiccmd by skin name */\ X (BotAI),/* B_BuildTailsTiccmd by skin name */\
...@@ -86,6 +91,7 @@ automatically. ...@@ -86,6 +91,7 @@ automatically.
X (scores),/* emblems/multiplayer list */\ X (scores),/* emblems/multiplayer list */\
X (title),/* titlescreen */\ X (title),/* titlescreen */\
X (titlecard),\ X (titlecard),\
X (escpanel) /* rings/time/score/emblem panel in pause menu */,\
X (intermission),\ X (intermission),\
X (continue),\ X (continue),\
X (playersetup),\ X (playersetup),\
...@@ -127,6 +133,10 @@ int LUA_HookCharacterHUD ...@@ -127,6 +133,10 @@ int LUA_HookCharacterHUD
INT32 skinIndex, UINT8 sprite2, UINT8 frame, UINT8 rotation, skincolornum_t color, INT32 skinIndex, UINT8 sprite2, UINT8 frame, UINT8 rotation, skincolornum_t color,
INT32 ticker, boolean mode INT32 ticker, boolean mode
); );
boolean LUA_HookEscapePanel(
int hook, huddrawlist_h drawlist,
int x, int y, int width, int height
);
int LUA_HookMobj(mobj_t *, int hook); int LUA_HookMobj(mobj_t *, int hook);
int LUA_Hook2Mobj(mobj_t *, mobj_t *, int hook); int LUA_Hook2Mobj(mobj_t *, mobj_t *, int hook);
...@@ -135,6 +145,7 @@ void LUA_HookBool(boolean value, int hook); ...@@ -135,6 +145,7 @@ void LUA_HookBool(boolean value, int hook);
int LUA_HookPlayer(player_t *, int hook); int LUA_HookPlayer(player_t *, int hook);
int LUA_HookTiccmd(player_t *, ticcmd_t *, int hook); int LUA_HookTiccmd(player_t *, ticcmd_t *, int hook);
int LUA_HookKey(event_t *event, int hook); // Hooks for key events int LUA_HookKey(event_t *event, int hook); // Hooks for key events
int LUA_HookText(event_t *event, int hook); // Hooks for text events
void LUA_HookPreThinkFrame(void); void LUA_HookPreThinkFrame(void);
void LUA_HookThinkFrame(void); void LUA_HookThinkFrame(void);
...@@ -153,11 +164,13 @@ int LUA_HookMapThingSpawn(mobj_t *, mapthing_t *); ...@@ -153,11 +164,13 @@ int LUA_HookMapThingSpawn(mobj_t *, mapthing_t *);
int LUA_HookFollowMobj(player_t *, mobj_t *); int LUA_HookFollowMobj(player_t *, mobj_t *);
int LUA_HookPlayerCanDamage(player_t *, mobj_t *); int LUA_HookPlayerCanDamage(player_t *, mobj_t *);
void LUA_HookPlayerQuit(player_t *, kickreason_t); void LUA_HookPlayerQuit(player_t *, kickreason_t);
int LUA_HookNameChange(player_t *plr, const char *name);
int LUA_HookTeamSwitch(player_t *, int newteam, boolean fromspectators, boolean tryingautobalance, boolean tryingscramble); int LUA_HookTeamSwitch(player_t *, int newteam, boolean fromspectators, boolean tryingautobalance, boolean tryingscramble);
int LUA_HookViewpointSwitch(player_t *player, player_t *newdisplayplayer, boolean forced); int LUA_HookViewpointSwitch(player_t *player, player_t *newdisplayplayer, boolean forced);
int LUA_HookSeenPlayer(player_t *player, player_t *seenfriend); int LUA_HookSeenPlayer(player_t *player, player_t *seenfriend);
int LUA_HookShouldJingleContinue(player_t *, const char *musname); int LUA_HookShouldJingleContinue(player_t *, const char *musname);
int LUA_HookPlayerCmd(player_t *, ticcmd_t *); int LUA_HookPlayerCmd(player_t *, ticcmd_t *);
int LUA_HookMusicChange(const char *oldname, struct MusicChange *); int LUA_HookMusicChange(const char *oldname, struct MusicChange *);
int LUA_HookSoundPlay(sfxenum_t sfx_id, void *origin, const int origintype);
fixed_t LUA_HookPlayerHeight(player_t *player); fixed_t LUA_HookPlayerHeight(player_t *player);
int LUA_HookPlayerCanEnterSpinGaps(player_t *player); int LUA_HookPlayerCanEnterSpinGaps(player_t *player);
...@@ -690,6 +690,17 @@ int LUA_HookKey(event_t *event, int hook_type) ...@@ -690,6 +690,17 @@ int LUA_HookKey(event_t *event, int hook_type)
return hook.status; return hook.status;
} }
int LUA_HookText(event_t *event, int hook_type)
{
Hook_State hook;
if (prepare_hook(&hook, false, hook_type))
{
LUA_PushUserdata(gL, event, META_TEXTEVENT);
call_hooks(&hook, 1, res_true);
}
return hook.status;
}
void LUA_HookHUD(int hook_type, huddrawlist_h list) void LUA_HookHUD(int hook_type, huddrawlist_h list)
{ {
Hook_State hook; Hook_State hook;
...@@ -727,6 +738,22 @@ int LUA_HookCharacterHUD ...@@ -727,6 +738,22 @@ int LUA_HookCharacterHUD
return hook.status; return hook.status;
} }
boolean LUA_HookEscapePanel(int hook, huddrawlist_h drawlist, int x, int y, int width, int height)
{
Hook_State hookstate;
if (prepare_hud_hook(&hookstate, false, hook))
{
LUA_SetHudHook(hook, drawlist);
lua_pushinteger(gL, x);
lua_pushinteger(gL, y);
lua_pushinteger(gL, width);
lua_pushinteger(gL, height);
call_hud_hooks(&hookstate, 1, res_true);
}
return hookstate.status;
}
/* ========================================================================= /* =========================================================================
SPECIALIZED HOOKS SPECIALIZED HOOKS
========================================================================= */ ========================================================================= */
...@@ -1077,6 +1104,18 @@ void LUA_HookPlayerQuit(player_t *plr, kickreason_t reason) ...@@ -1077,6 +1104,18 @@ void LUA_HookPlayerQuit(player_t *plr, kickreason_t reason)
} }
} }
int LUA_HookNameChange(player_t *plr, const char *name)
{
Hook_State hook;
if (prepare_hook(&hook, true, HOOK(NameChange)))
{
LUA_PushUserdata(gL, plr, META_PLAYER); // Player that changed name
lua_pushstring(gL, name); // New player name
call_hooks(&hook, 1, res_false);
}
return hook.status;
}
int LUA_HookTeamSwitch(player_t *player, int newteam, boolean fromspectators, boolean tryingautobalance, boolean tryingscramble) int LUA_HookTeamSwitch(player_t *player, int newteam, boolean fromspectators, boolean tryingautobalance, boolean tryingscramble)
{ {
Hook_State hook; Hook_State hook;
...@@ -1227,6 +1266,47 @@ int LUA_HookMusicChange(const char *oldname, struct MusicChange *param) ...@@ -1227,6 +1266,47 @@ int LUA_HookMusicChange(const char *oldname, struct MusicChange *param)
return hook.status; return hook.status;
} }
static void res_soundplay(Hook_State* hook)
{
if (!lua_isnil(gL, -1))
{
UINT32 sfx_id = lua_tonumber(gL, -1);
if (lua_isboolean(gL, -1) && lua_toboolean(gL, -1))
hook->status = 0; //sfx_None if returning True
//Make sure number is in range
else if (!lua_isboolean(gL, -1)
&& (sfx_id < NUMSFX))
hook->status = sfx_id;
if (sfx_id >= NUMSFX)
CONS_Alert(CONS_WARNING, "sfx %d out of range (0 - %d)\n", sfx_id, NUMSFX-1);
}
}
int LUA_HookSoundPlay(sfxenum_t sfx_id, void *origin, const int origintype)
{
Hook_State hook;
if (prepare_hook(&hook, sfx_id, HOOK(SoundPlay)))
{
lua_pushinteger(gL, sfx_id);
if (origin != NULL)
{
if (origintype == 0)
LUA_PushUserdata(gL, (mobj_t*)origin, META_MOBJ);
else if (origintype == 1)
LUA_PushUserdata(gL, (sector_t*)origin, META_SECTOR);
lua_pushinteger(gL, origintype);
}
hud_running = true; // local hook
call_hooks(&hook, 1, res_soundplay);
hud_running = false;
}
return hook.status;
}
static void res_playerheight(Hook_State *hook) static void res_playerheight(Hook_State *hook)
{ {
if (!lua_isnil(gL, -1)) if (!lua_isnil(gL, -1))
......
...@@ -20,6 +20,10 @@ enum hud { ...@@ -20,6 +20,10 @@ enum hud {
hud_textspectator, hud_textspectator,
hud_crosshair, hud_crosshair,
hud_powerups, hud_powerups,
hud_gameover,
hud_pause,
hud_cecho,
hud_chat,
// Singleplayer / Co-op // Singleplayer / Co-op
hud_score, hud_score,
hud_time, hud_time,
...@@ -30,6 +34,7 @@ enum hud { ...@@ -30,6 +34,7 @@ enum hud {
hud_weaponrings, hud_weaponrings,
hud_powerstones, hud_powerstones,
hud_teamscores, hud_teamscores,
hud_itemhunt,
// NiGHTS mode // NiGHTS mode
hud_nightslink, hud_nightslink,
hud_nightsdrill, hud_nightsdrill,
......
...@@ -42,6 +42,10 @@ static const char *const hud_disable_options[] = { ...@@ -42,6 +42,10 @@ static const char *const hud_disable_options[] = {
"textspectator", "textspectator",
"crosshair", "crosshair",
"powerups", "powerups",
"gameover",
"pause",
"cecho",
"chat",
"score", "score",
"time", "time",
...@@ -52,6 +56,7 @@ static const char *const hud_disable_options[] = { ...@@ -52,6 +56,7 @@ static const char *const hud_disable_options[] = {
"weaponrings", "weaponrings",
"powerstones", "powerstones",
"teamscores", "teamscores",
"itemhunt",
"nightslink", "nightslink",
"nightsdrill", "nightsdrill",
...@@ -461,15 +466,29 @@ static int camera_set(lua_State *L) ...@@ -461,15 +466,29 @@ static int camera_set(lua_State *L)
static int libd_patchExists(lua_State *L) static int libd_patchExists(lua_State *L)
{ {
HUDONLY
lua_pushboolean(L, W_LumpExists(luaL_checkstring(L, 1))); lua_pushboolean(L, W_LumpExists(luaL_checkstring(L, 1)));
return 1; return 1;
} }
static int libd_cachePatch(lua_State *L) static int libd_cachePatch(lua_State *L)
{ {
HUDONLY const char *name = luaL_checkstring(L, 1);
LUA_PushUserdata(L, W_CachePatchLongName(luaL_checkstring(L, 1), PU_PATCH), META_PATCH); patch_t *patch = W_CachePatchLongName(name, PU_PATCH);
#ifdef ROTSPRITE
if (lua_isnumber(L, 2))
{
angle_t rollangle = luaL_checkangle(L, 2);
INT32 rot = R_GetRollAngle(rollangle);
if (rot) {
patch_t *rotpatch = Patch_GetRotated(patch, rot, false);
LUA_PushUserdata(L, rotpatch, META_PATCH);
return 1;
}
}
#endif
LUA_PushUserdata(L, patch, META_PATCH);
return 1; return 1;
} }
...@@ -481,7 +500,6 @@ static int libd_getSpritePatch(lua_State *L) ...@@ -481,7 +500,6 @@ static int libd_getSpritePatch(lua_State *L)
UINT8 angle = 0; UINT8 angle = 0;
spritedef_t *sprdef; spritedef_t *sprdef;
spriteframe_t *sprframe; spriteframe_t *sprframe;
HUDONLY
if (lua_isnumber(L, 1)) // sprite number given, e.g. SPR_THOK if (lua_isnumber(L, 1)) // sprite number given, e.g. SPR_THOK
{ {
...@@ -555,7 +573,6 @@ static int libd_getSprite2Patch(lua_State *L) ...@@ -555,7 +573,6 @@ static int libd_getSprite2Patch(lua_State *L)
spritedef_t *sprdef; spritedef_t *sprdef;
spriteframe_t *sprframe; spriteframe_t *sprframe;
boolean super = false; // add SPR2F_SUPER to sprite2 if true boolean super = false; // add SPR2F_SUPER to sprite2 if true
HUDONLY
// get skin first! // get skin first!
if (lua_isnumber(L, 1)) // find skin by number if (lua_isnumber(L, 1)) // find skin by number
...@@ -875,6 +892,28 @@ static int libd_drawFill(lua_State *L) ...@@ -875,6 +892,28 @@ static int libd_drawFill(lua_State *L)
return 0; return 0;
} }
static int libd_drawFixedFill(lua_State *L)
{
huddrawlist_h list;
INT32 x = luaL_optinteger(L, 1, 0);
INT32 y = luaL_optinteger(L, 2, 0);
INT32 w = luaL_optinteger(L, 3, BASEVIDWIDTH << FRACBITS);
INT32 h = luaL_optinteger(L, 4, BASEVIDHEIGHT << FRACBITS);
INT32 c = luaL_optinteger(L, 5, 31);
HUDONLY
lua_getfield(L, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
list = (huddrawlist_h) lua_touserdata(L, -1);
lua_pop(L, 1);
if (LUA_HUD_IsDrawListValid(list))
LUA_HUD_AddDrawFixedFill(list, x, y, w, h, c);
else
V_DrawFixedFill(x, y, w, h, c);
return 0;
}
static int libd_drawString(lua_State *L) static int libd_drawString(lua_State *L)
{ {
huddrawlist_h list; huddrawlist_h list;
...@@ -1130,13 +1169,12 @@ static int libd_levelTitleHeight(lua_State *L) ...@@ -1130,13 +1169,12 @@ static int libd_levelTitleHeight(lua_State *L)
static int libd_getColormap(lua_State *L) static int libd_getColormap(lua_State *L)
{ {
HUDONLY
INT32 skinnum = TC_DEFAULT; INT32 skinnum = TC_DEFAULT;
skincolornum_t color = luaL_optinteger(L, 2, 0); skincolornum_t color = luaL_optinteger(L, 2, 0);
UINT8* colormap = NULL; UINT8* colormap = NULL;
int translation_id = -1; int translation_id = -1;
HUDONLY
if (lua_isnoneornil(L, 1)) if (lua_isnoneornil(L, 1))
; // defaults to TC_DEFAULT ; // defaults to TC_DEFAULT
else if (lua_type(L, 1) == LUA_TNUMBER) // skin number else if (lua_type(L, 1) == LUA_TNUMBER) // skin number
...@@ -1176,9 +1214,10 @@ static int libd_getColormap(lua_State *L) ...@@ -1176,9 +1214,10 @@ static int libd_getColormap(lua_State *L)
static int libd_getStringColormap(lua_State *L) static int libd_getStringColormap(lua_State *L)
{ {
HUDONLY
INT32 flags = luaL_checkinteger(L, 1); INT32 flags = luaL_checkinteger(L, 1);
UINT8* colormap = NULL; UINT8* colormap = NULL;
HUDONLY
colormap = V_GetStringColormap(flags & V_CHARCOLORMASK); colormap = V_GetStringColormap(flags & V_CHARCOLORMASK);
if (colormap) { if (colormap) {
LUA_PushUserdata(L, colormap, META_COLORMAP); // push as META_COLORMAP userdata, specifically for patches to use! LUA_PushUserdata(L, colormap, META_COLORMAP); // push as META_COLORMAP userdata, specifically for patches to use!
...@@ -1189,6 +1228,7 @@ static int libd_getStringColormap(lua_State *L) ...@@ -1189,6 +1228,7 @@ static int libd_getStringColormap(lua_State *L)
static int libd_getSectorColormap(lua_State *L) static int libd_getSectorColormap(lua_State *L)
{ {
HUDONLY
boolean has_sector = false; boolean has_sector = false;
sector_t *sector = NULL; sector_t *sector = NULL;
if (!lua_isnoneornil(L, 1)) if (!lua_isnoneornil(L, 1))
...@@ -1264,21 +1304,18 @@ static int libd_fadeScreen(lua_State *L) ...@@ -1264,21 +1304,18 @@ static int libd_fadeScreen(lua_State *L)
static int libd_width(lua_State *L) static int libd_width(lua_State *L)
{ {
HUDONLY
lua_pushinteger(L, vid.width); // push screen width lua_pushinteger(L, vid.width); // push screen width
return 1; return 1;
} }
static int libd_height(lua_State *L) static int libd_height(lua_State *L)
{ {
HUDONLY
lua_pushinteger(L, vid.height); // push screen height lua_pushinteger(L, vid.height); // push screen height
return 1; return 1;
} }
static int libd_dup(lua_State *L) static int libd_dup(lua_State *L)
{ {
HUDONLY
lua_pushinteger(L, vid.dup); // push integral scale (patch scale) lua_pushinteger(L, vid.dup); // push integral scale (patch scale)
lua_pushfixed(L, vid.fdup); // push fixed point scale (position scale) lua_pushfixed(L, vid.fdup); // push fixed point scale (position scale)
return 2; return 2;
...@@ -1286,7 +1323,6 @@ static int libd_dup(lua_State *L) ...@@ -1286,7 +1323,6 @@ static int libd_dup(lua_State *L)
static int libd_renderer(lua_State *L) static int libd_renderer(lua_State *L)
{ {
HUDONLY
switch (rendermode) { switch (rendermode) {
case render_opengl: lua_pushliteral(L, "opengl"); break; // OpenGL renderer case render_opengl: lua_pushliteral(L, "opengl"); break; // OpenGL renderer
case render_soft: lua_pushliteral(L, "software"); break; // Software renderer case render_soft: lua_pushliteral(L, "software"); break; // Software renderer
...@@ -1300,14 +1336,12 @@ static int libd_renderer(lua_State *L) ...@@ -1300,14 +1336,12 @@ static int libd_renderer(lua_State *L)
static int libd_RandomFixed(lua_State *L) static int libd_RandomFixed(lua_State *L)
{ {
HUDONLY
lua_pushfixed(L, M_RandomFixed()); lua_pushfixed(L, M_RandomFixed());
return 1; return 1;
} }
static int libd_RandomByte(lua_State *L) static int libd_RandomByte(lua_State *L)
{ {
HUDONLY
lua_pushinteger(L, M_RandomByte()); lua_pushinteger(L, M_RandomByte());
return 1; return 1;
} }
...@@ -1316,7 +1350,6 @@ static int libd_RandomKey(lua_State *L) ...@@ -1316,7 +1350,6 @@ static int libd_RandomKey(lua_State *L)
{ {
INT32 a = (INT32)luaL_checkinteger(L, 1); INT32 a = (INT32)luaL_checkinteger(L, 1);
HUDONLY
lua_pushinteger(L, M_RandomKey(a)); lua_pushinteger(L, M_RandomKey(a));
return 1; return 1;
} }
...@@ -1326,7 +1359,6 @@ static int libd_RandomRange(lua_State *L) ...@@ -1326,7 +1359,6 @@ static int libd_RandomRange(lua_State *L)
INT32 a = (INT32)luaL_checkinteger(L, 1); INT32 a = (INT32)luaL_checkinteger(L, 1);
INT32 b = (INT32)luaL_checkinteger(L, 2); INT32 b = (INT32)luaL_checkinteger(L, 2);
HUDONLY
lua_pushinteger(L, M_RandomRange(a, b)); lua_pushinteger(L, M_RandomRange(a, b));
return 1; return 1;
} }
...@@ -1334,7 +1366,6 @@ static int libd_RandomRange(lua_State *L) ...@@ -1334,7 +1366,6 @@ static int libd_RandomRange(lua_State *L)
// Macros. // Macros.
static int libd_SignedRandom(lua_State *L) static int libd_SignedRandom(lua_State *L)
{ {
HUDONLY
lua_pushinteger(L, M_SignedRandom()); lua_pushinteger(L, M_SignedRandom());
return 1; return 1;
} }
...@@ -1342,7 +1373,6 @@ static int libd_SignedRandom(lua_State *L) ...@@ -1342,7 +1373,6 @@ static int libd_SignedRandom(lua_State *L)
static int libd_RandomChance(lua_State *L) static int libd_RandomChance(lua_State *L)
{ {
fixed_t p = luaL_checkfixed(L, 1); fixed_t p = luaL_checkfixed(L, 1);
HUDONLY
lua_pushboolean(L, M_RandomChance(p)); lua_pushboolean(L, M_RandomChance(p));
return 1; return 1;
} }
...@@ -1351,7 +1381,6 @@ static int libd_RandomChance(lua_State *L) ...@@ -1351,7 +1381,6 @@ static int libd_RandomChance(lua_State *L)
// Could as well be thrown in global vars for ease of access but I guess it makes sense for it to be a HUD fn // Could as well be thrown in global vars for ease of access but I guess it makes sense for it to be a HUD fn
static int libd_getlocaltransflag(lua_State *L) static int libd_getlocaltransflag(lua_State *L)
{ {
HUDONLY
lua_pushinteger(L, (10-st_translucency)*V_10TRANS); lua_pushinteger(L, (10-st_translucency)*V_10TRANS);
return 1; return 1;
} }
...@@ -1359,7 +1388,6 @@ static int libd_getlocaltransflag(lua_State *L) ...@@ -1359,7 +1388,6 @@ static int libd_getlocaltransflag(lua_State *L)
// Get cv_translucenthud's value for HUD rendering as a normal V_xxTRANS int // Get cv_translucenthud's value for HUD rendering as a normal V_xxTRANS int
static int libd_getusertransflag(lua_State *L) static int libd_getusertransflag(lua_State *L)
{ {
HUDONLY
lua_pushinteger(L, (10-cv_translucenthud.value)*V_10TRANS); // A bit weird that it's called "translucenthud" yet 10 is fully opaque :V lua_pushinteger(L, (10-cv_translucenthud.value)*V_10TRANS); // A bit weird that it's called "translucenthud" yet 10 is fully opaque :V
return 1; return 1;
} }
...@@ -1381,6 +1409,7 @@ static luaL_Reg lib_draw[] = { ...@@ -1381,6 +1409,7 @@ static luaL_Reg lib_draw[] = {
{"drawNum", libd_drawNum}, {"drawNum", libd_drawNum},
{"drawPaddedNum", libd_drawPaddedNum}, {"drawPaddedNum", libd_drawPaddedNum},
{"drawFill", libd_drawFill}, {"drawFill", libd_drawFill},
{"drawFixedFill", libd_drawFixedFill},
{"drawString", libd_drawString}, {"drawString", libd_drawString},
{"drawNameTag", libd_drawNameTag}, {"drawNameTag", libd_drawNameTag},
{"drawScaledNameTag", libd_drawScaledNameTag}, {"drawScaledNameTag", libd_drawScaledNameTag},
...@@ -1452,6 +1481,26 @@ static luaL_Reg lib_hud[] = { ...@@ -1452,6 +1481,26 @@ static luaL_Reg lib_hud[] = {
{"disable", lib_huddisable}, {"disable", lib_huddisable},
{"enabled", lib_hudenabled}, {"enabled", lib_hudenabled},
{"add", lib_hudadd}, {"add", lib_hudadd},
{"patchExists", libd_patchExists},
{"cachePatch", libd_cachePatch},
{"getSpritePatch", libd_getSpritePatch},
{"getSprite2Patch", libd_getSprite2Patch},
{"width", libd_width},
{"height", libd_height},
{"scale", libd_dup},
{"renderer", libd_renderer},
{NULL, NULL}
};
// globalized client_side random functions.
static luaL_Reg lib_randomclient[] = {
// m_random
{"localFixed",libd_RandomFixed},
{"localByte",libd_RandomByte},
{"localKey",libd_RandomKey},
{"localRange",libd_RandomRange},
{"localSignedRandom",libd_SignedRandom}, // MACRO
{"localChance",libd_RandomChance}, // MACRO
{NULL, NULL} {NULL, NULL}
}; };
...@@ -1478,6 +1527,7 @@ int LUA_HudLib(lua_State *L) ...@@ -1478,6 +1527,7 @@ int LUA_HudLib(lua_State *L)
LUA_RegisterGlobalUserdata(L, "hudinfo", lib_getHudInfo, NULL, lib_hudinfolen); LUA_RegisterGlobalUserdata(L, "hudinfo", lib_getHudInfo, NULL, lib_hudinfolen);
luaL_register(L, "hud", lib_hud); luaL_register(L, "hud", lib_hud);
luaL_register(L, "random", lib_randomclient);
return 0; return 0;
} }
......
...@@ -25,6 +25,7 @@ enum drawitem_e { ...@@ -25,6 +25,7 @@ enum drawitem_e {
DI_DrawNum, DI_DrawNum,
DI_DrawPaddedNum, DI_DrawPaddedNum,
DI_DrawFill, DI_DrawFill,
DI_DrawFixedFill,
DI_DrawString, DI_DrawString,
DI_DrawNameTag, DI_DrawNameTag,
DI_DrawScaledNameTag, DI_DrawScaledNameTag,
...@@ -346,6 +347,25 @@ void LUA_HUD_AddDrawFill( ...@@ -346,6 +347,25 @@ void LUA_HUD_AddDrawFill(
item->c = c; item->c = c;
} }
void LUA_HUD_AddDrawFixedFill(
huddrawlist_h list,
fixed_t x,
fixed_t y,
fixed_t w,
fixed_t h,
INT32 c
)
{
size_t i = AllocateDrawItem(list);
drawitem_t *item = &list->items[i];
item->type = DI_DrawFixedFill;
item->x = x;
item->y = y;
item->w = w;
item->h = h;
item->c = c;
}
void LUA_HUD_AddDrawString( void LUA_HUD_AddDrawString(
huddrawlist_h list, huddrawlist_h list,
fixed_t x, fixed_t x,
...@@ -482,6 +502,9 @@ void LUA_HUD_DrawList(huddrawlist_h list) ...@@ -482,6 +502,9 @@ void LUA_HUD_DrawList(huddrawlist_h list)
case DI_DrawFill: case DI_DrawFill:
V_DrawFill(item->x, item->y, item->w, item->h, item->c); V_DrawFill(item->x, item->y, item->w, item->h, item->c);
break; break;
case DI_DrawFixedFill:
V_DrawFixedFill(item->x, item->y, item->w, item->h, item->c);
break;
case DI_DrawString: case DI_DrawString:
switch(item->align) switch(item->align)
{ {
......
...@@ -98,6 +98,14 @@ void LUA_HUD_AddDrawFill( ...@@ -98,6 +98,14 @@ void LUA_HUD_AddDrawFill(
INT32 h, INT32 h,
INT32 c INT32 c
); );
void LUA_HUD_AddDrawFixedFill(
huddrawlist_h list,
fixed_t x,
fixed_t y,
fixed_t w,
fixed_t h,
INT32 c
);
void LUA_HUD_AddDrawString( void LUA_HUD_AddDrawString(
huddrawlist_h list, huddrawlist_h list,
fixed_t x, fixed_t x,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.