static int libd_drawString(lua_State *L) { fixed_t x = luaL_checkinteger(L, 1); fixed_t y = luaL_checkinteger(L, 2); const char *str = luaL_checkstring(L, 3); INT32 flags = luaL_optinteger(L, 4, V_ALLOWLOWERCASE); enum align align = luaL_checkoption(L, 5, "left", align_opt); flags &= ~V_PARAMMASK; // Don't let crashes happen. if (!hud_running) return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!"); switch(align) { case align_left: V_DrawString(x, y, flags, str); break; case align_center: V_DrawCenteredString(x, y, flags, str); break; case align_right: V_DrawRightAlignedString(x, y, flags, str); break; case align_fixed: V_DrawStringAtFixed(x, y, flags, str); break; } return 0; }
static int libd_drawString(lua_State *L) { fixed_t x = luaL_checkinteger(L, 1); fixed_t y = luaL_checkinteger(L, 2); const char *str = luaL_checkstring(L, 3); INT32 flags = luaL_optinteger(L, 4, V_ALLOWLOWERCASE); enum align align = luaL_checkoption(L, 5, "left", align_opt); flags &= ~V_PARAMMASK; // Don't let crashes happen. HUDONLY switch(align) { // hu_font case align_left: V_DrawString(x, y, flags, str); break; case align_center: V_DrawCenteredString(x, y, flags, str); break; case align_right: V_DrawRightAlignedString(x, y, flags, str); break; case align_fixed: V_DrawStringAtFixed(x, y, flags, str); break; // hu_font, 0.5x scale case align_small: V_DrawSmallString(x, y, flags, str); break; case align_smallright: V_DrawRightAlignedSmallString(x, y, flags, str); break; // tny_font case align_thin: V_DrawThinString(x, y, flags, str); break; case align_thinright: V_DrawRightAlignedThinString(x, y, flags, str); break; } return 0; }
// poly : the convex polygon that encloses all child subsectors static void WalkBSPNode(INT32 bspnum, poly_t *poly, UINT16 *leafnode, fixed_t *bbox) { node_t *bsp; poly_t *backpoly, *frontpoly; fdivline_t fdivline; polyvertex_t *pt; INT32 i; // Found a subsector? if (bspnum & NF_SUBSECTOR) { if (bspnum == -1) { // BP: i think this code is useless and wrong because // - bspnum==-1 happens only when numsubsectors == 0 // - it can't happens in bsp recursive call since bspnum is a INT32 and children is UINT16 // - the BSP is complet !! (there just can have subsector without segs) (i am not sure of this point) // do we have a valid polygon ? if (poly && poly->numpts > 2) { DEBPRINT("Adding a new subsector\n"); if (addsubsector == numsubsectors + NEWSUBSECTORS) I_Error("WalkBSPNode: not enough addsubsectors\n"); else if (addsubsector > 0x7fff) I_Error("WalkBSPNode: addsubsector > 0x7fff\n"); *leafnode = (UINT16)((UINT16)addsubsector | NF_SUBSECTOR); extrasubsectors[addsubsector].planepoly = poly; addsubsector++; } //add subsectors without segs here? //HWR_SubsecPoly(0, NULL); } else { HWR_SubsecPoly(bspnum&(~NF_SUBSECTOR), poly); //Hurdler: implement a loading status if (ls_count-- <= 0) { char s[16]; int x, y; I_OsPolling(); ls_count = numsubsectors/50; CON_Drawer(); sprintf(s, "%d%%", (++ls_percent)<<1); x = BASEVIDWIDTH/2; y = BASEVIDHEIGHT/2; V_DrawFill(0, 0, vid.width, vid.height, 31); // Black background to match fade in effect //V_DrawPatchFill(W_CachePatchName("SRB2BACK",PU_CACHE)); // SRB2 background, ehhh too bright. M_DrawTextBox(x-58, y-8, 13, 1); V_DrawString(x-50, y, V_YELLOWMAP, "Loading..."); V_DrawString(x+50-V_StringWidth(s), y, V_YELLOWMAP, s); // Is this really necessary at this point..? V_DrawCenteredString(BASEVIDWIDTH/2, 40, V_YELLOWMAP, "OPENGL MODE IS INCOMPLETE AND MAY"); V_DrawCenteredString(BASEVIDWIDTH/2, 50, V_YELLOWMAP, "NOT DISPLAY SOME SURFACES."); V_DrawCenteredString(BASEVIDWIDTH/2, 70, V_YELLOWMAP, "USE AT SONIC'S RISK."); I_UpdateNoVsync(); } } M_ClearBox(bbox); poly = extrasubsectors[bspnum&~NF_SUBSECTOR].planepoly; for (i = 0, pt = poly->pts; i < poly->numpts; i++,pt++) M_AddToBox(bbox, FLOAT_TO_FIXED(pt->x), FLOAT_TO_FIXED(pt->y)); return; } bsp = &nodes[bspnum]; SearchDivline(bsp, &fdivline); SplitPoly(&fdivline, poly, &frontpoly, &backpoly); poly = NULL; //debug if (!backpoly) nobackpoly++; // Recursively divide front space. if (frontpoly) { WalkBSPNode(bsp->children[0], frontpoly, &bsp->children[0],bsp->bbox[0]); // copy child bbox M_Memcpy(bbox, bsp->bbox[0], 4*sizeof (fixed_t)); } else I_Error("WalkBSPNode: no front poly?"); // Recursively divide back space. if (backpoly) { // Correct back bbox to include floor/ceiling convex polygon WalkBSPNode(bsp->children[1], backpoly, &bsp->children[1], bsp->bbox[1]); // enlarge bbox with seconde child M_AddToBox(bbox, bsp->bbox[1][BOXLEFT ], bsp->bbox[1][BOXTOP ]); M_AddToBox(bbox, bsp->bbox[1][BOXRIGHT ], bsp->bbox[1][BOXBOTTOM]); } }