void OpenWeaponUpgradeMenu (edict_t *ent, int lastline) { int i; if (!ShowMenu(ent)) return; clearmenu(ent); addlinetomenu(ent, "Weapon Upgrades", MENU_GREEN_CENTERED); addlinetomenu(ent, " ", 0); addlinetomenu(ent, "Select the weapon you", 0); addlinetomenu(ent, "want to upgrade:", 0); addlinetomenu(ent, " ", 0); for (i = 0; i < MAX_WEAPONS; ++i) { char weaponString[24]; strcpy(weaponString, GetWeaponString(i)); padRight(weaponString, 18); addlinetomenu(ent, va("%s%d%c", weaponString, V_WeaponUpgradeVal(ent, i),'%'), (i+10)*100); } addlinetomenu(ent, " ", 0); addlinetomenu(ent, "Exit", 6666); setmenuhandler(ent, weaponmenu_handler); if (lastline) ent->client->menustorage.currentline = lastline + 5; else ent->client->menustorage.currentline = MAX_WEAPONS + 7; showmenu(ent); // try to shortcut to chat-protect mode if (ent->client->idle_frames < CHAT_PROTECT_FRAMES-51) ent->client->idle_frames = CHAT_PROTECT_FRAMES-51; }
void OpenGeneralWeaponMenu (edict_t *ent, int lastline) { int WeaponIndex = (lastline / 100) - 10; int modIndex = (lastline % 100); int i; if (!ShowMenu(ent)) return; clearmenu(ent); addlinetomenu(ent, va("%s\n(%d%c)", GetWeaponString(WeaponIndex), V_WeaponUpgradeVal(ent, WeaponIndex), '%'), MENU_GREEN_CENTERED); addlinetomenu(ent, va("Weapon points left: %d", ent->myskills.weapon_points), MENU_GREEN_CENTERED); addlinetomenu(ent, " ", 0); addlinetomenu(ent, " Select the weapon", 0); addlinetomenu(ent, " attribute you want to", 0); addlinetomenu(ent, " improve upon.", 0); addlinetomenu(ent, " ", 0); for (i = 0; i < MAX_WEAPONMODS; ++i) { char sMod[30]; int level, cur; level = ent->myskills.weapons[WeaponIndex].mods[i].level; cur = ent->myskills.weapons[WeaponIndex].mods[i].current_level; strcpy(sMod, GetModString(WeaponIndex, i)); padRight(sMod, 15); strcat(sMod, va("%d", level)); padRight(sMod, 18); addlinetomenu(ent, va("%s[%d]", sMod, cur), ((WeaponIndex+10)*100) + i + 1); } setmenuhandler(ent, generalWeaponMenu_handler); if (modIndex) ent->client->menustorage.currentline = modIndex + 7; else ent->client->menustorage.currentline = 14; addlinetomenu(ent, " ", 0); addlinetomenu(ent, "Previous Menu", 7777 + WeaponIndex); addlinetomenu(ent, "Exit", 6666); showmenu(ent); }
void V_PrintItemProperties(edict_t *player, item_t *item) { char buf[256]; int i; //Did they find a unique? if (strlen(item->name) > 0) { gi.centerprintf(player, "WOW! It's \"%s\"!!\n", item->name); return; } strcpy(buf, GetRuneValString(item)); switch(item->itemtype) { case ITEM_WEAPON: strcat(buf, " weapon rune "); break; case ITEM_ABILITY: strcat(buf, " ability rune "); break; case ITEM_COMBO: strcat(buf, " combo rune "); break; case ITEM_CLASSRUNE:strcpy(buf, va(" %s rune ", GetRuneValString(item))); break; } if(item->numMods == 1) strcat(buf, "(1 mod)"); else strcat(buf, va("(%d mods)", item->numMods)); for (i = 0; i < MAX_VRXITEMMODS; ++i) { char temp[32]; //skip bad mod types if ((item->modifiers[i].type != TYPE_ABILITY) && (item->modifiers[i].type != TYPE_WEAPON) || item->modifiers[i].value < 1) continue; switch(item->modifiers[i].type) { case TYPE_ABILITY: strcpy(temp, va("%s:", GetAbilityString(item->modifiers[i].index))); break; case TYPE_WEAPON: strcpy(temp, va("%s %s:", GetShortWeaponString((item->modifiers[i].index / 100)-10), GetModString((item->modifiers[i].index / 100)-10, item->modifiers[i].index % 100))); break; } padRight(temp, 20); strcat(buf, va("\n %s(%d)", temp, item->modifiers[i].value)); } gi.centerprintf(player, "%s\n", buf); }
void OpenTalentUpgradeMenu (edict_t *ent, int lastline) { talent_t *talent; char buffer[30]; int i; if (!ShowMenu(ent)) return; clearmenu(ent); // menu header addlinetomenu(ent, "Talents", MENU_GREEN_CENTERED); addlinetomenu(ent, " ", 0); for (i = 0; i < ent->myskills.talents.count; i++) { talent = &ent->myskills.talents.talent[i]; //create menu string strcpy(buffer, GetTalentString(talent->id)); strcat(buffer, ":"); padRight(buffer, 15); addlinetomenu(ent, va("%d. %s %d/%d", i+1, buffer, talent->upgradeLevel, talent->maxLevel), talent->id); } // menu footer addlinetomenu(ent, " ", 0); addlinetomenu(ent, va("You have %d talent points.", ent->myskills.talents.talentPoints), 0); addlinetomenu(ent, " ", 0); addlinetomenu(ent, "Exit", 9999); setmenuhandler(ent, openTalentMenu_handler); if (!lastline) ent->client->menustorage.currentline = ent->myskills.talents.count + 6; else ent->client->menustorage.currentline = lastline + 2; showmenu(ent); // try to shortcut to chat-protect mode if (ent->client->idle_frames < CHAT_PROTECT_FRAMES-51) ent->client->idle_frames = CHAT_PROTECT_FRAMES-51; }
void OpenBuyRuneMenu(edict_t *ent, int page_num, int lastline) { int i; armoryRune_t *firstItem; //Usual menu stuff if (!ShowMenu(ent)) return; clearmenu(ent); //Header addlinetomenu(ent, va("You have %d credits", ent->myskills.credits), MENU_GREEN_CENTERED); addlinetomenu(ent, "Please make a selection:", MENU_GREEN_CENTERED); addlinetomenu(ent, " ", 0); switch(page_num) { case 1: firstItem = WeaponRunes; break; case 2: firstItem = AbilityRunes; break; case 3: firstItem = ComboRunes; break; default: gi.dprintf("Error in OpenBuyRuneMenu(). Invalid page number: %d\n", page_num); return; } //Print this page's items for (i = 0; i < ARMORY_MAX_RUNES; ++i) { item_t *rune = &((firstItem + i)->rune); if (rune->itemtype != ITEM_NONE) { char buf[32]; strcpy(buf, V_MenuItemString(rune, ' ')); padRight(buf, 18); addlinetomenu(ent, va("%s%d", buf, getBuyValue(rune)), (page_num * 1000) + i + 1); } else { switch(page_num) { case 1: addlinetomenu(ent, " <Empty Weapon Slot>", 0); break; case 2: addlinetomenu(ent, " <Empty Ability Slot>", 0); break; case 3: addlinetomenu(ent, " <Empty Combo Slot>", 0); break; } } } //Footer addlinetomenu(ent, " ", 0); if (page_num < 3) addlinetomenu(ent, "Next", (page_num*10)+2); addlinetomenu(ent, "Back", (page_num*10)+1); addlinetomenu(ent, "Exit", 99); //Menu handler setmenuhandler(ent, BuyRuneMenu_handler); //Set the menu cursor if (lastline) ent->client->menustorage.currentline = 4 + lastline; else ent->client->menustorage.currentline = 15; //Show the menu showmenu(ent); }
void StartShowInventoryMenu(edict_t *ent, item_t *item) { int type = item->itemtype; int linecount = 1; int i; if (!ShowMenu(ent)) return; clearmenu(ent); //If item has a name, use that instead if (strlen(item->name) > 0) { if (item->setCode == 0) addlinetomenu(ent, va(" %s", item->name), MENU_GREEN_LEFT); else addlinetomenu(ent, va(" %s (set item)", item->name), MENU_GREEN_LEFT); } else { //Print header, depending on the item type addlinetomenu(ent, va("%s", V_MenuItemString(item, ' ')), MENU_GREEN_LEFT); } //Unique runes need to display stats too if (type & ITEM_UNIQUE) type ^= ITEM_UNIQUE; //Item's stats switch(type) { case ITEM_WEAPON: { int wIndex = (item->modifiers[0].index / 100) - 10; addlinetomenu(ent, " ", 0); addlinetomenu(ent, va(" %s", GetWeaponString(wIndex)), 0); addlinetomenu(ent, " ", 0); addlinetomenu(ent, " Stats:", MENU_GREEN_LEFT); linecount += 4; for (i = 0; i < MAX_VRXITEMMODS; ++i) { int mIndex; char buf[30]; if ((item->modifiers[i].type == TYPE_NONE) || (V_HiddenMod(ent, item, &item->modifiers[i]))) continue; mIndex = item->modifiers[i].index % 100; strcpy(buf, GetModString(wIndex, mIndex)); padRight(buf, 20); addlinetomenu(ent, va(" %s [%d]", buf, item->modifiers[i].value ), 0); ++linecount; } addlinetomenu(ent, " ", 0); ++linecount; } break; case ITEM_ABILITY: { addlinetomenu(ent, " ", 0); addlinetomenu(ent, " Stats:", MENU_GREEN_LEFT); linecount += 2; for (i = 0; i < MAX_VRXITEMMODS; ++i) { int aIndex; char buf[30]; aIndex = item->modifiers[i].index; if ((item->modifiers[i].type == TYPE_NONE) || (V_HiddenMod(ent, item, &item->modifiers[i]))) continue; strcpy(buf, GetAbilityString(aIndex)); padRight(buf, 20); addlinetomenu(ent, va(" %s [%d]", buf, item->modifiers[i].value ), 0); linecount++; } } break; case ITEM_COMBO: { addlinetomenu(ent, " ", 0); addlinetomenu(ent, " Stats:", MENU_GREEN_LEFT); linecount += 2; for (i = 0; i < MAX_VRXITEMMODS; ++i) { char buf[30]; if ((item->modifiers[i].type == TYPE_NONE) || (V_HiddenMod(ent, item, &item->modifiers[i]))) continue; switch(item->modifiers[i].type) { case TYPE_ABILITY: { int aIndex; aIndex = item->modifiers[i].index; strcpy(buf, GetAbilityString(aIndex)); padRight(buf, 20); addlinetomenu(ent, va(" %s [%d]", buf, item->modifiers[i].value ), 0); linecount++; } break; case TYPE_WEAPON: { int wIndex = (item->modifiers[i].index / 100) - 10; int mIndex = item->modifiers[i].index % 100; strcpy(buf, GetShortWeaponString(wIndex)); strcat(buf, va(" %s", GetModString(wIndex, mIndex))); padRight(buf, 20); addlinetomenu(ent, va(" %s [%d]", buf, item->modifiers[i].value ), 0); linecount++; } break; } } } break; case ITEM_CLASSRUNE: { addlinetomenu(ent, " ", 0); addlinetomenu(ent, " Stats:", MENU_GREEN_LEFT); linecount += 2; for (i = 0; i < MAX_VRXITEMMODS; ++i) { int aIndex; char buf[30]; aIndex = item->modifiers[i].index; if (item->modifiers[i].type == TYPE_NONE) continue; strcpy(buf, GetAbilityString(aIndex)); padRight(buf, 20); addlinetomenu(ent, va(" %s [%d]", buf, item->modifiers[i].value ), 0); linecount++; } } break; } //Menu footer addlinetomenu(ent, " ", 0); //Items such as Gravity boots need to show the number of charges left if ((item->itemtype & ITEM_GRAVBOOTS) || (item->itemtype & ITEM_FIRE_RESIST) || (item->itemtype & ITEM_AUTO_TBALL)) { addlinetomenu(ent, va(" Charges left: %d", item->quantity), 0); addlinetomenu(ent, " ", 0); linecount += 2; } ent->client->menustorage.currentline = linecount; }
void lat_padRight(lat_vm* vm){ lat_object* c = lat_pop_stack(vm); lat_object* b = lat_pop_stack(vm); lat_object* a = lat_pop_stack(vm); vm->regs[255] = lat_str(vm, padRight(lat_get_str_value(a), lat_get_int_value(b), lat_get_char_value(c))); }
void DeathmatchScoreboardMessage (edict_t *ent, edict_t *killer) { char entry[MAX_ENTRY_SIZE]; char string[MAX_STRING_SIZE]; char name[20], classname[20];//3.78 int stringlength; int i, j, k; int sorted[MAX_CLIENTS]; int sortedscores[MAX_CLIENTS]; int score, total, highscore=0; int y; //float accuracy; int time_left=999, frag_left=999; gclient_t *cl; edict_t *cl_ent; // if we are looking at the scoreboard or inventory, deactivate the scanner if (ent->client->showscores || ent->client->showinventory) { if (ent->client->pers.scanner_active) ent->client->pers.scanner_active = 2; } else { *string = 0; // Scanner active ? if (ent->client->pers.scanner_active & 1) ShowScanner(ent,string); // normal quake code ... gi.WriteByte (svc_layout); gi.WriteString (string); return; } // sort the clients by score total = 0; for (i=0 ; i<game.maxclients ; i++) { cl_ent = g_edicts + 1 + i; //3.0 scoreboard code fix if (!cl_ent->client || !cl_ent->inuse || cl_ent->client->resp.spectator) continue; score = game.clients[i].resp.score; for (j=0 ; j<total ; j++) { if (score > sortedscores[j]) break; } for (k=total ; k>j ; k--) { sorted[k] = sorted[k-1]; sortedscores[k] = sortedscores[k-1]; } sorted[j] = i; sortedscores[j] = score; total++; } // print level name and exit rules string[0] = 0; stringlength = strlen(string); // make a header for the data //K03 Begin if (timelimit->value) time_left = (timelimit->value*60 - level.time); else time_left = 60*99; if (fraglimit->value) frag_left = (fraglimit->value - V_HighestFragScore()); if (time_left < 0) time_left = 0; Com_sprintf(entry, sizeof(entry), "xv 0 yv 16 string2 \"Time:%2im %2is Frags:%3i Players:%3i\" " "xv 0 yv 24 string2 \"Name Lv Cl Score Frg Spr Png\" ", (int)(time_left/60), (int)(time_left-(int)((time_left/60)*60)), frag_left, total_players()); //K03 End j = strlen(entry); //gi.dprintf("header string length=%d\n", j); if (stringlength + j < MAX_ENTRY_SIZE) { strcpy (string + stringlength, entry); stringlength += j; } // add the clients in sorted order if (total > 24) total = 24; /* The screen is only so big :( */ for (i=0 ; i<total ; i++) { cl = &game.clients[sorted[i]]; cl_ent = g_edicts + 1 + sorted[i]; if (!cl_ent) continue; y = 34 + 8 * i; // 3.78 truncate client's name and class string strcpy(name, V_TruncateString(cl->pers.netname, 11)); strcpy(classname, V_TruncateString(GetClassString(cl_ent->myskills.class_num), 3)); padRight(name, 10); Com_sprintf(entry, sizeof(entry), "xv 0 yv %i string \"%s %2i %s %5i %3i %3i %3i\" ", y, name, cl_ent->myskills.level, classname, cl->resp.score, cl->resp.frags, cl_ent->myskills.streak, cl->ping); j = strlen(entry); //gi.dprintf("player string length=%d\n", j); if (stringlength + j > MAX_ENTRY_SIZE) break; strcpy (string + stringlength, entry); stringlength += j; } gi.WriteByte (svc_layout); gi.WriteString (string); }