void HUlib_addMessageToSText(hu_stext_t* s, char* prefix, char* msg) { HUlib_addLineToSText(s); if (prefix) while (*prefix) HUlib_addCharToTextLine(&s->l[s->cl], *prefix++); while (*msg) HUlib_addCharToTextLine(&s->l[s->cl], *msg++); }
// // HUlib_addMessageToMText() // // Adds a message line with prefix to a hu_mtext_t widget // // Passed a hu_mtext_t, the prefix string, and a message string // Returns nothing // void HUlib_addMessageToMText(hu_mtext_t* m, const char* prefix, const char* msg) { HUlib_addLineToMText(m); if (prefix) while (*prefix) HUlib_addCharToTextLine(&m->l[m->cl], *(prefix++)); while (*msg) HUlib_addCharToTextLine(&m->l[m->cl], *(msg++)); }
// // HU_Drawer() // // Draw all the pieces of the heads-up display // // Passed nothing, returns nothing // void HU_Drawer(void) { char *s; player_t *plr; char ammostr[80]; //jff 3/8/98 allow plenty room for dehacked mods char healthstr[80];//jff char armorstr[80]; //jff int i,doit; // don't draw anything if there's a fullscreen menu up if (menuactive == mnact_full) return; plr = &players[displayplayer]; // killough 3/7/98 // draw the automap widgets if automap is displayed if (automapmode & am_active) { // map title HUlib_drawTextLine(&w_title, false); //jff 2/16/98 output new coord display // x-coord if (map_point_coordinates) { sprintf(hud_coordstrx,"X: %-5d", (plr->mo->x)>>FRACBITS); HUlib_clearTextLine(&w_coordx); s = hud_coordstrx; while (*s) HUlib_addCharToTextLine(&w_coordx, *(s++)); HUlib_drawTextLine(&w_coordx, false); //jff 3/3/98 split coord display into x,y,z lines // y-coord sprintf(hud_coordstry,"Y: %-5d", (plr->mo->y)>>FRACBITS); HUlib_clearTextLine(&w_coordy); s = hud_coordstry; while (*s) HUlib_addCharToTextLine(&w_coordy, *(s++)); HUlib_drawTextLine(&w_coordy, false); //jff 3/3/98 split coord display into x,y,z lines //jff 2/22/98 added z // z-coord sprintf(hud_coordstrz,"Z: %-5d", (plr->mo->z)>>FRACBITS); HUlib_clearTextLine(&w_coordz); s = hud_coordstrz; while (*s) HUlib_addCharToTextLine(&w_coordz, *(s++)); HUlib_drawTextLine(&w_coordz, false); } }
void HU_Start(void) { char *s = strdup(automaptitle); int len = strlen(s); if (headsupactive) HU_Stop(); plr = &players[0]; message_on = false; message_dontfuckwithme = false; message_nottobefuckedwith = false; // create the message widget HUlib_initSText(&w_message, HU_MSGX, HU_MSGY, HU_MSGHEIGHT, hu_font, HU_FONTSTART, &message_on); // create the map title widget HUlib_initTextLine(&w_title, HU_TITLEX, HU_TITLEY, hu_font, HU_FONTSTART); while (M_StringWidth(s) > ORIGINALWIDTH - 6) { s[len - 1] = s[len] = s[len + 1] = '.'; s[len + 2] = '\0'; --len; } while (*s) HUlib_addCharToTextLine(&w_title, *(s++)); headsupactive = true; hudnumoffset = (16 - SHORT(tallnum[0]->height)) / 2; }
// // HUlib_addPrefixToIText() // // Adds a prefix string passed to a hu_itext_t widget // Sets left margin to length of string added // // Passed the hu_itext_t and the prefix string // Returns nothing // void HUlib_addPrefixToIText ( hu_itext_t* it, char* str ) { while (*str) HUlib_addCharToTextLine(&it->l, *(str++)); it->lm = it->l.len; }
boolean HUlib_keyInIText(hu_itext_t* it, unsigned char ch) { if (ch >= ' ' && ch <= '_') HUlib_addCharToTextLine(&it->l, (char) ch); else if (ch == key_backspace) // phares HUlib_delCharFromIText(it); else if (ch != key_enter) // phares return false; // did not eat key return true; // ate the key }
void HU_Start(void) { int i; char* s; if (headsupactive) HU_Stop(); plr = &players[consoleplayer]; message_on = false; message_dontfuckwithme = false; message_nottobefuckedwith = false; chat_on = false; // create the message widget HUlib_initSText(&w_message, HU_MSGX, HU_MSGY, HU_MSGHEIGHT, hu_font, HU_FONTSTART, &message_on); // create the map title widget HUlib_initTextLine(&w_title, HU_TITLEX, HU_TITLEY, hu_font, HU_FONTSTART); if (commercial) s = HU_TITLE2; else s = HU_TITLE; while (*s) HUlib_addCharToTextLine(&w_title, *(s++)); // create the chat widget HUlib_initIText(&w_chat, HU_INPUTX, HU_INPUTY, hu_font, HU_FONTSTART, &chat_on); // create the inputbuffer widgets for (i=0 ; i<MAXPLAYERS ; i++) HUlib_initIText(&w_inputbuffer[i], 0, 0, 0, 0, &always_off); headsupactive = true; }
// wrapper function for handling general keyed input. // returns true if it ate the key boolean HUlib_keyInIText ( hu_itext_t* it, unsigned char ch ) { if (ch >= ' ' && ch <= '_') HUlib_addCharToTextLine(&it->l, (char) ch); else if (ch == KEY_BACKSPACE) HUlib_delCharFromIText(it); else if (ch != KEY_ENTER) return false; // did not eat key return true; // ate the key }
void HU_Start(void) { int i; char* s; if (headsupactive) HU_Stop(); plr = &players[consoleplayer]; message_on = false; message_dontfuckwithme = false; message_nottobefuckedwith = false; chat_on = false; // create the message widget HUlib_initSText(&w_message, HU_MSGX, HU_MSGY, HU_MSGHEIGHT, hu_font, HU_FONTSTART, &message_on); // create the map title widget HUlib_initTextLine(&w_title, HU_TITLEX, HU_TITLEY, hu_font, HU_FONTSTART); switch ( gamemission ) { case doom: s = HU_TITLE; break; case doom2: s = HU_TITLE2; break; case pack_plut: s = HU_TITLEP; break; case pack_tnt: s = HU_TITLET; break; default: s = "Unknown level"; break; } // Chex.exe always uses the episode 1 level title // eg. E2M1 gives the title for E1M1 if (gameversion == exe_chex) { s = HU_TITLE_CHEX; } // dehacked substitution to get modified level name s = DEH_String(s); while (*s) HUlib_addCharToTextLine(&w_title, *(s++)); // create the chat widget HUlib_initIText(&w_chat, HU_INPUTX, HU_INPUTY, hu_font, HU_FONTSTART, &chat_on); // create the inputbuffer widgets for (i=0 ; i<MAXPLAYERS ; i++) HUlib_initIText(&w_inputbuffer[i], 0, 0, 0, 0, &always_off); headsupactive = true; }
void HU_Start(void) { int i; char* s; if (headsupactive) HU_Stop(); plr = &players[consoleplayer]; message_on = false; message_dontfuckwithme = false; message_nottobefuckedwith = false; chat_on = false; // create the message widget HUlib_initSText(&w_message, HU_MSGX, HU_MSGY, HU_MSGHEIGHT, hu_font, HU_FONTSTART, &message_on); // create the map title widget HUlib_initTextLine(&w_title, HU_TITLEX, HU_TITLEY, hu_font, HU_FONTSTART); switch ( gamemode ) { case shareware: case registered: case retail: s = HU_TITLE; break; /* FIXME case pack_plut: s = HU_TITLEP; break; case pack_tnt: s = HU_TITLET; break; */ case commercial: default: s = HU_TITLE2; break; } while (*s) HUlib_addCharToTextLine(&w_title, *(s++)); // create the chat widget HUlib_initIText(&w_chat, HU_INPUTX, HU_INPUTY, hu_font, HU_FONTSTART, &chat_on); // create the inputbuffer widgets for (i=0 ; i<MAXPLAYERS ; i++) HUlib_initIText(&w_inputbuffer[i], 0, 0, 0, 0, &always_off); headsupactive = true; }
// // HU_Start(void) // // Create and initialize the heads-up widgets, software machines to // maintain, update, and display information over the primary display // // This routine must be called after any change to the heads up configuration // in order for the changes to take effect in the actual displays // // Passed nothing, returns nothing // void HU_Start(void) { int i; char* s; if (headsupactive) // stop before starting HU_Stop(); plr = &players[displayplayer]; // killough 3/7/98 message_on = false; message_dontfuckwithme = false; message_nottobefuckedwith = false; chat_on = false; // create the message widget // messages to player in upper-left of screen HUlib_initSText ( &w_message, HU_MSGX, HU_MSGY, HU_MSGHEIGHT, hu_font, HU_FONTSTART, colrngs[hudcolor_mesg], &message_on ); //jff 2/16/98 added some HUD widgets // create the map title widget - map title display in lower left of automap HUlib_initTextLine ( &w_title, HU_TITLEX, HU_TITLEY, hu_font, HU_FONTSTART, colrngs[hudcolor_titl] ); // create the hud health widget // bargraph and number for amount of health, // lower left or upper right of screen HUlib_initTextLine ( &w_health, hud_distributed? HU_HEALTHX_D : HU_HEALTHX, //3/4/98 distribute hud_distributed? HU_HEALTHY_D : HU_HEALTHY, hu_font2, HU_FONTSTART, colrngs[CR_GREEN] ); // create the hud armor widget // bargraph and number for amount of armor, // lower left or upper right of screen HUlib_initTextLine ( &w_armor, hud_distributed? HU_ARMORX_D : HU_ARMORX, //3/4/98 distribute hud_distributed? HU_ARMORY_D : HU_ARMORY, hu_font2, HU_FONTSTART, colrngs[CR_GREEN] ); // create the hud ammo widget // bargraph and number for amount of ammo for current weapon, // lower left or lower right of screen HUlib_initTextLine ( &w_ammo, hud_distributed? HU_AMMOX_D : HU_AMMOX, //3/4/98 distribute hud_distributed? HU_AMMOY_D : HU_AMMOY, hu_font2, HU_FONTSTART, colrngs[CR_GOLD] ); // create the hud weapons widget // list of numbers of weapons possessed // lower left or lower right of screen HUlib_initTextLine ( &w_weapon, hud_distributed? HU_WEAPX_D : HU_WEAPX, //3/4/98 distribute hud_distributed? HU_WEAPY_D : HU_WEAPY, hu_font2, HU_FONTSTART, colrngs[CR_GRAY] ); // create the hud keys widget // display of key letters possessed // lower left of screen HUlib_initTextLine ( &w_keys, hud_distributed? HU_KEYSX_D : HU_KEYSX, //3/4/98 distribute hud_distributed? HU_KEYSY_D : HU_KEYSY, hu_font2, HU_FONTSTART, colrngs[CR_GRAY] ); // create the hud graphic keys widget // display of key graphics possessed // lower left of screen HUlib_initTextLine ( &w_gkeys, hud_distributed? HU_KEYSGX_D : HU_KEYSGX, //3/4/98 distribute hud_distributed? HU_KEYSY_D : HU_KEYSY, hu_fontk, HU_FONTSTART, colrngs[CR_RED] ); // create the hud monster/secret widget // totals and current values for kills, items, secrets // lower left of screen HUlib_initTextLine ( &w_monsec, hud_distributed? HU_MONSECX_D : HU_MONSECX, //3/4/98 distribute hud_distributed? HU_MONSECY_D : HU_MONSECY, hu_font2, HU_FONTSTART, colrngs[CR_GRAY] ); // create the hud text refresh widget // scrolling display of last hud_msg_lines messages received if (hud_msg_lines>HU_MAXMESSAGES) hud_msg_lines=HU_MAXMESSAGES; //jff 4/21/98 if setup has disabled message list while active, turn it off message_list = hud_msg_lines > 1; //jff 8/8/98 initialize both ways //jff 2/26/98 add the text refresh widget initialization HUlib_initMText ( &w_rtext, 0, 0, SCREENWIDTH, (hud_msg_lines+2)*HU_REFRESHSPACING, hu_font, HU_FONTSTART, colrngs[hudcolor_list], hu_msgbg, &message_list ); // initialize the automap's level title widget switch (gamemode) { case shareware: case registered: case retail: s = HU_TITLE; break; case commercial: default: // Ty 08/27/98 - modified to check mission for TNT/Plutonia s = (gamemission==pack_tnt) ? HU_TITLET : (gamemission==pack_plut) ? HU_TITLEP : HU_TITLE2; break; } while (*s) HUlib_addCharToTextLine(&w_title, *(s++)); // create the automaps coordinate widget // jff 3/3/98 split coord widget into three lines: x,y,z // jff 2/16/98 added HUlib_initTextLine ( &w_coordx, HU_COORDX, HU_COORDX_Y, hu_font, HU_FONTSTART, colrngs[hudcolor_xyco] ); HUlib_initTextLine ( &w_coordy, HU_COORDX, HU_COORDY_Y, hu_font, HU_FONTSTART, colrngs[hudcolor_xyco] ); HUlib_initTextLine ( &w_coordz, HU_COORDX, HU_COORDZ_Y, hu_font, HU_FONTSTART, colrngs[hudcolor_xyco] ); // initialize the automaps coordinate widget //jff 3/3/98 split coordstr widget into 3 parts sprintf(hud_coordstrx,"X: %-5d",0); //jff 2/22/98 added z s = hud_coordstrx; while (*s) HUlib_addCharToTextLine(&w_coordx, *(s++)); sprintf(hud_coordstry,"Y: %-5d",0); //jff 3/3/98 split x,y,z s = hud_coordstry; while (*s) HUlib_addCharToTextLine(&w_coordy, *(s++)); sprintf(hud_coordstrz,"Z: %-5d",0); //jff 3/3/98 split x,y,z s = hud_coordstrz; while (*s) HUlib_addCharToTextLine(&w_coordz, *(s++)); //jff 2/16/98 initialize ammo widget strcpy(hud_ammostr,"AMM "); s = hud_ammostr; while (*s) HUlib_addCharToTextLine(&w_ammo, *(s++)); //jff 2/16/98 initialize health widget strcpy(hud_healthstr,"HEL "); s = hud_healthstr; while (*s) HUlib_addCharToTextLine(&w_health, *(s++)); //jff 2/16/98 initialize armor widget strcpy(hud_armorstr,"ARM "); s = hud_armorstr; while (*s) HUlib_addCharToTextLine(&w_armor, *(s++)); //jff 2/17/98 initialize weapons widget strcpy(hud_weapstr,"WEA "); s = hud_weapstr; while (*s) HUlib_addCharToTextLine(&w_weapon, *(s++)); //jff 2/17/98 initialize keys widget if (!deathmatch) //jff 3/17/98 show frags in deathmatch mode strcpy(hud_keysstr,"KEY "); else strcpy(hud_keysstr,"FRG "); s = hud_keysstr; while (*s) HUlib_addCharToTextLine(&w_keys, *(s++)); //jff 2/17/98 initialize graphic keys widget strcpy(hud_gkeysstr," "); s = hud_gkeysstr; while (*s) HUlib_addCharToTextLine(&w_gkeys, *(s++)); //jff 2/17/98 initialize kills/items/secret widget strcpy(hud_monsecstr,"STS "); s = hud_monsecstr; while (*s) HUlib_addCharToTextLine(&w_monsec, *(s++)); // create the chat widget HUlib_initIText ( &w_chat, HU_INPUTX, HU_INPUTY, hu_font, HU_FONTSTART, colrngs[hudcolor_chat], &chat_on ); // create the inputbuffer widgets, one per player for (i=0 ; i<MAXPLAYERS ; i++) HUlib_initIText ( &w_inputbuffer[i], 0, 0, 0, 0, colrngs[hudcolor_chat], &always_off ); // now allow the heads-up display to run headsupactive = true; }
// // HU_Drawer() // // Draw all the pieces of the heads-up display // // Passed nothing, returns nothing // void HU_Drawer(void) { char* s; player_t* plr; char ammostr[80]; //jff 3/8/98 allow plenty room for dehacked mods char healthstr[80];//jff char armorstr[80]; //jff int i; plr = &players[displayplayer]; // killough 3/7/98 // draw the automap widgets if automap is displayed if (automapactive) { fixed_t x, y, z; // killough 10/98: void AM_Coordinates(const mobj_t*, fixed_t*, fixed_t*, fixed_t*); // map title HUlib_drawTextLine(&w_title, false); // killough 10/98: allow coordinates to display non-following pointer AM_Coordinates(plr->mo, &x, &y, &z); //jff 2/16/98 output new coord display // x-coord sprintf(hud_coordstrx, "X: %-5d", x >> FRACBITS); // killough 10/98 HUlib_clearTextLine(&w_coordx); s = hud_coordstrx; while (*s) HUlib_addCharToTextLine(&w_coordx, *s++); HUlib_drawTextLine(&w_coordx, false); //jff 3/3/98 split coord display into x,y,z lines // y-coord sprintf(hud_coordstry, "Y: %-5d", y >> FRACBITS); // killough 10/98 HUlib_clearTextLine(&w_coordy); s = hud_coordstry; while (*s) HUlib_addCharToTextLine(&w_coordy, *s++); HUlib_drawTextLine(&w_coordy, false); //jff 3/3/98 split coord display into x,y,z lines //jff 2/22/98 added z // z-coord sprintf(hud_coordstrz, "Z: %-5d", z >> FRACBITS); // killough 10/98 HUlib_clearTextLine(&w_coordz); s = hud_coordstrz; while (*s) HUlib_addCharToTextLine(&w_coordz, *s++); HUlib_drawTextLine(&w_coordz, false); } // draw the weapon/health/ammo/armor/kills/keys displays if optioned //jff 2/17/98 allow new hud stuff to be turned off // killough 2/21/98: really allow new hud stuff to be turned off COMPLETELY if ( hud_active > 0 && // hud optioned on hud_displayed && // hud on from fullscreen key scaledviewheight == SCREENHEIGHT && // fullscreen mode is active !automapactive // automap is not active ) { HU_MoveHud(); // insure HUD display coords are correct // do the hud ammo display // clear the widgets internal line HUlib_clearTextLine(&w_ammo); strcpy(hud_ammostr, "AMM "); if (weaponinfo[plr->readyweapon].ammo == am_noammo) { // special case for weapon with no ammo selected - blank bargraph + N/A strcat(hud_ammostr, "\x7f\x7f\x7f\x7f\x7f\x7f\x7f N/A"); w_ammo.cr = colrngs[CR_GRAY]; } else { int ammo = plr->ammo[weaponinfo[plr->readyweapon].ammo]; int fullammo = plr->maxammo[weaponinfo[plr->readyweapon].ammo]; int ammopct = (100 * ammo) / fullammo; int ammobars = ammopct / 4; // build the numeric amount init string sprintf(ammostr, "%d/%d", ammo, fullammo); // build the bargraph string // full bargraph chars for (i = 4; i < 4 + ammobars / 4;) hud_ammostr[i++] = 123; // plus one last character with 0,1,2,3 bars switch (ammobars % 4) { case 0: break; case 1: hud_ammostr[i++] = 126; break; case 2: hud_ammostr[i++] = 125; break; case 3: hud_ammostr[i++] = 124; break; } // pad string with blank bar characters while (i < 4 + 7) hud_ammostr[i++] = 127; hud_ammostr[i] = '\0'; strcat(hud_ammostr, ammostr); // set the display color from the percentage of total ammo held if (ammopct < ammo_red) w_ammo.cr = colrngs[CR_RED]; else if (ammopct < ammo_yellow) w_ammo.cr = colrngs[CR_GOLD]; else w_ammo.cr = colrngs[CR_GREEN]; } // transfer the init string to the widget s = hud_ammostr; while (*s) HUlib_addCharToTextLine(&w_ammo, *s++); // display the ammo widget every frame HUlib_drawTextLine(&w_ammo, false); // do the hud health display { int health = plr->health; int healthbars = health > 100 ? 25 : health / 4; // clear the widgets internal line HUlib_clearTextLine(&w_health); // build the numeric amount init string sprintf(healthstr, "%3d", health); // build the bargraph string // full bargraph chars for (i = 4; i < 4 + healthbars / 4;) hud_healthstr[i++] = 123; // plus one last character with 0,1,2,3 bars switch (healthbars % 4) { case 0: break; case 1: hud_healthstr[i++] = 126; break; case 2: hud_healthstr[i++] = 125; break; case 3: hud_healthstr[i++] = 124; break; } // pad string with blank bar characters while (i < 4 + 7) hud_healthstr[i++] = 127; hud_healthstr[i] = '\0'; strcat(hud_healthstr, healthstr); // set the display color from the amount of health posessed if (health < health_red) w_health.cr = colrngs[CR_RED]; else if (health < health_yellow) w_health.cr = colrngs[CR_GOLD]; else if (health <= health_green) w_health.cr = colrngs[CR_GREEN]; else w_health.cr = colrngs[CR_BLUE]; // transfer the init string to the widget s = hud_healthstr; while (*s) HUlib_addCharToTextLine(&w_health, *s++); } // display the health widget every frame HUlib_drawTextLine(&w_health, false); // do the hud armor display { int armor = plr->armorpoints; int armorbars = armor > 100 ? 25 : armor / 4; // clear the widgets internal line HUlib_clearTextLine(&w_armor); // build the numeric amount init string sprintf(armorstr, "%3d", armor); // build the bargraph string // full bargraph chars for (i = 4; i < 4 + armorbars / 4;) hud_armorstr[i++] = 123; // plus one last character with 0,1,2,3 bars switch (armorbars % 4) { case 0: break; case 1: hud_armorstr[i++] = 126; break; case 2: hud_armorstr[i++] = 125; break; case 3: hud_armorstr[i++] = 124; break; } // pad string with blank bar characters while (i < 4 + 7) hud_armorstr[i++] = 127; hud_armorstr[i] = '\0'; strcat(hud_armorstr, armorstr); // set the display color from the amount of armor posessed w_armor.cr = armor < armor_red ? colrngs[CR_RED] : armor < armor_yellow ? colrngs[CR_GOLD] : armor <= armor_green ? colrngs[CR_GREEN] : colrngs[CR_BLUE]; // transfer the init string to the widget s = hud_armorstr; while (*s) HUlib_addCharToTextLine(&w_armor, *s++); } // display the armor widget every frame HUlib_drawTextLine(&w_armor, false); // do the hud weapon display { int w, ammo, fullammo, ammopct; // clear the widgets internal line HUlib_clearTextLine(&w_weapon); i = 4; hud_weapstr[i] = '\0'; //jff 3/7/98 make sure ammo goes away // do each weapon that exists in current gamemode for (w = 0; w <= wp_supershotgun; w++) //jff 3/4/98 show fists too, why not? { int ok = 1; //jff avoid executing for weapons that do not exist switch (gamemode) { case shareware: if (w >= wp_plasma && w != wp_chainsaw) ok = 0; break; case retail: case registered: if (w >= wp_supershotgun) ok = 0; break; default: case commercial: break; } if (!ok) continue; ammo = plr->ammo[weaponinfo[w].ammo]; fullammo = plr->maxammo[weaponinfo[w].ammo]; ammopct = 0; // skip weapons not currently posessed if (!plr->weaponowned[w]) continue; ammopct = fullammo ? (100 * ammo) / fullammo : 100; // display each weapon number in a color related to the ammo for it hud_weapstr[i++] = '\x1b'; //jff 3/26/98 use ESC not '\' for paths if (weaponinfo[w].ammo == am_noammo) //jff 3/14/98 show berserk on HUD hud_weapstr[i++] = plr->powers[pw_strength] ? '0' + CR_GREEN : '0' + CR_GRAY; else if (ammopct < ammo_red) hud_weapstr[i++] = '0' + CR_RED; else if (ammopct < ammo_yellow) hud_weapstr[i++] = '0' + CR_GOLD; else hud_weapstr[i++] = '0' + CR_GREEN; hud_weapstr[i++] = '0' + w + 1; hud_weapstr[i++] = ' '; hud_weapstr[i] = '\0'; } // transfer the init string to the widget s = hud_weapstr; while (*s) HUlib_addCharToTextLine(&w_weapon, *s++); } // display the weapon widget every frame HUlib_drawTextLine(&w_weapon, false); if (hud_active > 1) { int k; hud_keysstr[4] = '\0'; //jff 3/7/98 make sure deleted keys go away //jff add case for graphic key display if (!deathmatch && hud_graph_keys) { i = 0; hud_gkeysstr[i] = '\0'; //jff 3/7/98 init graphic keys widget string // build text string whose characters call out graphic keys from fontk for (k = 0; k < 6; k++) { // skip keys not possessed if (!plr->cards[k]) continue; hud_gkeysstr[i++] = '!' + k; // key number plus '!' is char for key hud_gkeysstr[i++] = ' '; // spacing hud_gkeysstr[i++] = ' '; } hud_gkeysstr[i] = '\0'; } else // not possible in current code, unless deathmatching, { i = 4; hud_keysstr[i] = '\0'; //jff 3/7/98 make sure deleted keys go away // if deathmatch, build string showing top four frag counts if (deathmatch) //jff 3/17/98 show frags, not keys, in deathmatch { int top1 = -999, top2 = -999, top3 = -999, top4 = -999; int idx1 = -1, idx2 = -1, idx3 = -1, idx4 = -1; int fragcount, m; // scan thru players for (k = 0; k < MAXPLAYERS; k++) { // skip players not in game if (!playeringame[k]) continue; fragcount = 0; // compute number of times they've fragged each player // minus number of times they've been fragged by them for (m = 0; m < MAXPLAYERS; m++) { if (!playeringame[m]) continue; fragcount += (m != k) ? players[k].frags[m] : -players[k].frags[m]; } // very primitive sort of frags to find top four if (fragcount > top1) { top4 = top3; top3 = top2; top2 = top1; top1 = fragcount; idx4 = idx3; idx3 = idx2; idx2 = idx1; idx1 = k; } else if (fragcount > top2) { top4 = top3; top3 = top2; top2 = fragcount; idx4 = idx3; idx3 = idx2; idx2 = k; } else if (fragcount > top3) { top4 = top3; top3 = fragcount; idx4 = idx3; idx3 = k; } else if (fragcount > top4) { top4 = fragcount; idx4 = k; } } // killough 11/98: replaced cut-and-pasted code with function // if the biggest number exists, // put it in the init string i = HU_top(i, idx1, top1); // if the second biggest number exists, // put it in the init string i = HU_top(i, idx2, top2); // if the third biggest number exists, // put it in the init string i = HU_top(i, idx3, top3); // if the fourth biggest number exists, // put it in the init string i = HU_top(i, idx4, top4); hud_keysstr[i] = '\0'; } //jff 3/17/98 end of deathmatch clause else // build alphabetical key display (not used currently) { // scan the keys for (k = 0; k < 6; k++) { // skip any not possessed by the displayed player's stats if (!plr->cards[k]) continue; // use color escapes to make text in key's color hud_keysstr[i++] = '\x1b'; //jff 3/26/98 use ESC not '\' for paths switch (k) { case 0: hud_keysstr[i++] = '0' + CR_BLUE; hud_keysstr[i++] = 'B'; hud_keysstr[i++] = 'C'; hud_keysstr[i++] = ' '; break; case 1: hud_keysstr[i++] = '0' + CR_GOLD; hud_keysstr[i++] = 'Y'; hud_keysstr[i++] = 'C'; hud_keysstr[i++] = ' '; break; case 2: hud_keysstr[i++] = '0' + CR_RED; hud_keysstr[i++] = 'R'; hud_keysstr[i++] = 'C'; hud_keysstr[i++] = ' '; break; case 3: hud_keysstr[i++] = '0' + CR_BLUE; hud_keysstr[i++] = 'B'; hud_keysstr[i++] = 'S'; hud_keysstr[i++] = ' '; break; case 4: hud_keysstr[i++] = '0' + CR_GOLD; hud_keysstr[i++] = 'Y'; hud_keysstr[i++] = 'S'; hud_keysstr[i++] = ' '; break; case 5: hud_keysstr[i++] = '0' + CR_RED; hud_keysstr[i++] = 'R'; hud_keysstr[i++] = 'S'; hud_keysstr[i++] = ' '; break; } hud_keysstr[i] = '\0'; } } } } // display the keys/frags line each frame if (hud_active > 1) { HUlib_clearTextLine(&w_keys); // clear the widget strings HUlib_clearTextLine(&w_gkeys); // transfer the built string (frags or key title) to the widget s = hud_keysstr; //jff 3/7/98 display key titles/key text or frags while (*s) HUlib_addCharToTextLine(&w_keys, *s++); HUlib_drawTextLine(&w_keys, false); //jff 3/17/98 show graphic keys in non-DM only if (!deathmatch) //jff 3/7/98 display graphic keys { // transfer the graphic key text to the widget s = hud_gkeysstr; while (*s) HUlib_addCharToTextLine(&w_gkeys, *s++); // display the widget HUlib_drawTextLine(&w_gkeys, false); } } // display the hud kills/items/secret display if optioned if (!hud_nosecrets) { if (hud_active > 1) { // clear the internal widget text buffer HUlib_clearTextLine(&w_monsec); //jff 3/26/98 use ESC not '\' for paths // build the init string with fixed colors sprintf(hud_monsecstr, "STS \x1b\x36K \x1b\x33%d/%d" " \x1b\x37I \x1b\x33%d/%d \x1b\x35S \x1b\x33%d/%d", plr->killcount, totalkills, plr->itemcount, totalitems, plr->secretcount, totalsecret); // transfer the init string to the widget s = hud_monsecstr; while (*s) HUlib_addCharToTextLine(&w_monsec, *s++); } // display the kills/items/secrets each frame, if optioned if (hud_active > 1) HUlib_drawTextLine(&w_monsec, false); } } //jff 3/4/98 display last to give priority // jff 4/24/98 Erase current lines before drawing current // needed when screen not fullsize // killough 11/98: only do it when not fullsize if (scaledviewheight < 200) HU_Erase(); //jff 4/21/98 if setup has disabled message list while active, turn it off // if the message review is enabled show the scrolling message review // if the message review not enabled, show the standard message widget // killough 11/98: simplified if (message_list) HUlib_drawMText(&w_rtext); else HUlib_drawSText(&w_message); // display the interactive buffer for chat entry HUlib_drawIText(&w_chat); }
void HU_Start(void) { int i; const char* s; if (::g->headsupactive) HU_Stop(); ::g->plr = &::g->players[::g->consoleplayer]; ::g->message_on = false; ::g->message_dontfuckwithme = false; ::g->message_nottobefuckedwith = false; ::g->chat_on = false; // create the message widget HUlib_initSText(&::g->w_message, HU_MSGX, HU_MSGY, HU_MSGHEIGHT, ::g->hu_font, HU_FONTSTART, &::g->message_on); // create the map title widget HUlib_initTextLine(&::g->w_title, HU_TITLEX, HU_TITLEY, ::g->hu_font, HU_FONTSTART); switch ( ::g->gamemode ) { case shareware: case registered: case retail: s = HU_TITLE; break; case commercial: default: if( DoomLib::expansionSelected == 5 ) { int map = ::g->gamemap; if( ::g->gamemap > 9 ) { map = 0; } s = DoomLib::GetCurrentExpansion()->mapNames[ map - 1 ]; } else { s = DoomLib::GetCurrentExpansion()->mapNames[ ::g->gamemap - 1 ]; } break; } while (*s) HUlib_addCharToTextLine(&::g->w_title, *(s++)); // create the chat widget HUlib_initIText(&::g->w_chat, HU_INPUTX, HU_INPUTY, ::g->hu_font, HU_FONTSTART, &::g->chat_on); // create the inputbuffer widgets for (i=0 ; i<MAXPLAYERS ; i++) HUlib_initIText(&::g->w_inputbuffer[i], 0, 0, 0, 0, &::g->always_off); ::g->headsupactive = true; }
void HU_Start(void) { int i; const char *s; if (headsupactive) HU_Stop(); plr = &players[consoleplayer]; message_on = false; message_dontfuckwithme = false; message_nottobefuckedwith = false; chat_on = false; // create the message widget HUlib_initSText(&w_message, HU_MSGX, HU_MSGY, HU_MSGHEIGHT, hu_font, HU_FONTSTART, &message_on); // create the map title widget HUlib_initTextLine(&w_title, HU_TITLEX, HU_TITLEY, hu_font, HU_FONTSTART); switch ( logical_gamemission ) { case doom: s = HU_TITLE; break; case doom2: s = HU_TITLE2; // Pre-Final Doom compatibility: map33-map35 names don't spill over if (gameversion <= exe_doom_1_9 && gamemap >= 33) { s = ""; } break; case pack_plut: s = HU_TITLEP; break; case pack_tnt: s = HU_TITLET; break; default: s = "Unknown level"; break; } if (logical_gamemission == doom && gameversion == exe_chex) { s = HU_TITLE_CHEX; } // dehacked substitution to get modified level name s = DEH_String(s); while (*s) HUlib_addCharToTextLine(&w_title, *(s++)); // create the chat widget HUlib_initIText(&w_chat, HU_INPUTX, HU_INPUTY, hu_font, HU_FONTSTART, &chat_on); // create the inputbuffer widgets for (i=0 ; i<MAXPLAYERS ; i++) HUlib_initIText(&w_inputbuffer[i], 0, 0, 0, 0, &always_off); headsupactive = true; }