/*! \brief Draw player's stats * * Draw the terse stats of a single player. * \param where Bitmap to draw onto * \param i Player (index in party array) to show info for * \param dx x-coord of stats view * \param dy y-coord of stats view */ void draw_playerstat(BITMAP *where, int i, int dx, int dy) { int j; draw_sprite(where, players[i].portrait, dx, dy); print_font(where, dx + 48, dy, party[i].name, FNORMAL); draw_stsicon(where, 0, i, 8, dx + 48, dy + 8); print_font(where, dx + 48, dy + 16, _("LV"), FGOLD); sprintf(strbuf, "%d", party[i].lvl); print_font(where, dx + 104 - (strlen(strbuf) * 8), dy + 16, strbuf, FNORMAL); print_font(where, dx + 48, dy + 24, _("HP"), FGOLD); print_font(where, dx + 104, dy + 24, "/", FNORMAL); sprintf(strbuf, "%d", party[i].hp); j = strlen(strbuf) * 8; print_font(where, dx + 104 - j, dy + 24, strbuf, FNORMAL); sprintf(strbuf, "%d", party[i].mhp); j = strlen(strbuf) * 8; print_font(where, dx + 144 - j, dy + 24, strbuf, FNORMAL); print_font(where, dx + 48, dy + 32, _("MP"), FGOLD); print_font(where, dx + 104, dy + 32, "/", FNORMAL); sprintf(strbuf, "%d", party[i].mp); j = strlen(strbuf) * 8; print_font(where, dx + 104 - j, dy + 32, strbuf, FNORMAL); sprintf(strbuf, "%d", party[i].mmp); j = strlen(strbuf) * 8; print_font(where, dx + 144 - j, dy + 32, strbuf, FNORMAL); }
/*! \brief Draw the battle screen * \author Josh Bolduc * \date Created ???????? * \date Updated 20020914 - 16:16 (RB) * * Draw the battle screen. * * \param plyr Player * \param hl Highlighted * \param sall Select all */ void battle_render (int plyr, int hl, int sall) { int a = 0; int b = 0; int sz; int t; int z; if (plyr > 0) { curw = fighter[plyr - 1].cw; curx = fighter[plyr - 1].cx; cury = fighter[plyr - 1].cy; } else { curx = -1; cury = -1; } clear_bitmap (double_buffer); blit ((BITMAP *) backart->dat, double_buffer, 0, 0, 0, 0, 320, 240); #ifdef DEBUGMODE if (debugging > 1) { rectfill (double_buffer, 0, 0, rcount / 2, 9, 15); sprintf (strbuf, "%d", rcount); print_font (double_buffer, 0, 20, strbuf, FNORMAL); sprintf (strbuf, "0: %d - %d", fighter[0].sts[S_POISON], fighter[0].sts[S_REGEN]); print_font (double_buffer, 0, 28, strbuf, FNORMAL); sprintf (strbuf, "1: %d - %d", fighter[1].sts[S_POISON], fighter[1].sts[S_REGEN]); print_font (double_buffer, 0, 36, strbuf, FNORMAL); } #endif if ((sall == 0) && (curx > -1) && (cury > -1)) { draw_sprite (double_buffer, bptr, curx + (curw / 2) - 8, cury - 8); if (plyr - 1 >= PSIZE) { t = curx + (curw / 2); t -= (strlen (fighter[plyr - 1].name) * 4); z = fighter[plyr - 1].cy - 32; if (z < 0) z = fighter[plyr - 1].cy + fighter[plyr - 1].cl; menubox (double_buffer, t - 8, z, strlen (fighter[plyr - 1].name), 1, BLUE); print_font (double_buffer, t, z + 8, fighter[plyr - 1].name, FNORMAL); } #ifdef DEBUGMODE if (debugging > 1) { /* RB TODO: Check this out. */ sprintf (strbuf, _("HP:%d (%d)"), fighter[plyr - 1].hp, fighter[plyr - 1].mhp); print_font (double_buffer, 0, 8, strbuf, FNORMAL); sprintf (strbuf, _("MP:%d (%d)"), fighter[plyr - 1].mp, fighter[plyr - 1].mmp); print_font (double_buffer, 0, 16, strbuf, FNORMAL); print_font (double_buffer, 0, 24, _("Str"), FNORMAL); print_font (double_buffer, 0, 32, _("Agi"), FNORMAL); print_font (double_buffer, 0, 40, _("Vit"), FNORMAL); print_font (double_buffer, 0, 48, _("Int"), FNORMAL); print_font (double_buffer, 0, 56, _("Sag"), FNORMAL); print_font (double_buffer, 0, 64, _("Spd"), FNORMAL); print_font (double_buffer, 0, 72, _("Aura"), FNORMAL); print_font (double_buffer, 0, 80, _("Spir"), FNORMAL); print_font (double_buffer, 0, 88, _("Att"), FNORMAL); print_font (double_buffer, 0, 96, _("Hit%"), FNORMAL); print_font (double_buffer, 0, 104, _("Def"), FNORMAL); print_font (double_buffer, 0, 112, _("Evd%"), FNORMAL); print_font (double_buffer, 0, 120, _("Mdef"), FNORMAL); sprintf (strbuf, "%d, %d, %d, %d", fighter[plyr - 1].cwt, fighter[plyr - 1].welem, fighter[plyr - 1].unl, fighter[plyr - 1].crit); print_font (double_buffer, 0, 128, strbuf, FNORMAL); sprintf (strbuf, "i -> %d,%d,%d,%d", fighter[plyr - 1].imb_s, fighter[plyr - 1].imb_a, fighter[plyr - 1].imb[0], fighter[plyr - 1].imb[1]); print_font (double_buffer, 0, 136, strbuf, FNORMAL); for (t = 0; t < 13; t++) { sprintf (strbuf, "%d", fighter[plyr - 1].stats[t]); print_font (double_buffer, 40, t * 8 + 24, strbuf, FNORMAL); } } #endif } for (z = 0; z < numchrs; z++) { b = z * 216; if (fighter[z].sts[S_DEAD] == 0) { draw_fighter (z, (sall == 1)); } else { fighter[z].aframe = 3; draw_fighter (z, 0); } menubox (double_buffer, b, 184, 11, 5, BLUE); if (fighter[z].sts[S_DEAD] == 0) { sz = bspeed[z] * 88 / ROUND_MAX; if (sz > 88) sz = 88; a = 116; if (fighter[z].sts[S_TIME] == 1) a = 83; if (fighter[z].sts[S_TIME] == 2) a = 36; a += (sz / 11); hline (double_buffer, b + 8, 229, b + sz + 8, a + 1); hline (double_buffer, b + 8, 230, b + sz + 8, a); hline (double_buffer, b + 8, 231, b + sz + 8, a - 1); } print_font (double_buffer, b + 8, 192, fighter[z].name, (hl == z + 1) ? FGOLD : FNORMAL); sprintf (strbuf, _("HP: %3d/%3d"), fighter[z].hp, fighter[z].mhp); /* RB IDEA: If the character has less than 1/5 of his/her max */ /* health points, it shows the amount with red (the */ /* character is in danger). I suggest setting that '5' */ /* as a '#define WARNING_LEVEL 5' or something like */ /* that, so we can change it easily (maybe we can let */ /* the player choose when it should be turned red). */ /* TT TODO: I like this idea; maybe somewhere in the Options */ /* menu? I find that when the bar flashes red/yellow */ /* to warn the player, it's much more eye-pleasing than */ /* just a solid color (and not too hard to implement). */ print_font (double_buffer, b + 8, 208, strbuf, (fighter[z].hp < (fighter[z].mhp / 5)) ? FRED : FNORMAL); hline (double_buffer, b + 8, 216, b + 95, 21); sz = (fighter[z].hp > 0) ? fighter[z].hp * 88 / fighter[z].mhp : 88; hline (double_buffer, b + 8, 216, b + 8 + sz, 12); sprintf (strbuf, _("MP: %3d/%3d"), fighter[z].mp, fighter[z].mmp); /* RB IDEA: Same suggestion as with health, just above. */ print_font (double_buffer, b + 8, 218, strbuf, (fighter[z].mp < (fighter[z].mmp / 5)) ? FRED : FNORMAL); hline (double_buffer, b + 8, 226, b + 95, 21); sz = (fighter[z].mp > 0) ? fighter[z].mp * 88 / fighter[z].mmp : 88; hline (double_buffer, b + 8, 226, b + 8 + sz, 12); draw_stsicon (double_buffer, 1, z, 17, b + 8, 200); } for (t = PSIZE; t < PSIZE + numens; t++) { if (fighter[t].sts[S_DEAD] == 0) { draw_fighter (t, (sall == 2)); } } if (dct == 1) { menubox (double_buffer, 152 - (strlen (ctext) * 4), 8, strlen (ctext), 1, BLUE); print_font (double_buffer, 160 - (strlen (ctext) * 4), 16, ctext, FNORMAL); } }