static void ShowAllKeys(int index, int change) { int x1, x2, y1, y2; x1 = CenterX((TextCharWidth('a') * 10)) / 2; x2 = x1 * 3; y1 = (SCREEN_HEIGHT / 2) - (TextHeight() * 10); y2 = (SCREEN_HEIGHT / 2) - (TextHeight() * 2); DisplayKeys(x1, x2, y1, "Player One", &gPlayer1Data, index, change); DisplayKeys(x1, x2, y2, "Player Two", &gPlayer2Data, index - 6, change - 6); y2 += TextHeight() * 8; TextStringAt(x1, y2, "Map"); if (change == 12) DisplayMenuItem(x2, y2, SELECTKEY, index == 12); else DisplayMenuItem(x2, y2, SDL_GetKeyName(gOptions.mapKey), index == 12); #define DONE "Done" y2 += TextHeight () * 2; DisplayMenuItem(CenterX(TextWidth(DONE)), y2, DONE, index == 13); }
void DisplayMenuItem(int x, int y, const char *s, int selected) { if (selected) TextStringWithTableAt(x, y, s, tableFlamed); else TextStringAt(x, y, s); return; }
static void Save(int asCode) { char filename[128]; // char drive[_MAX_DRIVE]; char dir[96]; char name[32]; // char ext[_MAX_EXT]; char c; int i; strcpy(filename, lastFile); while (1) { memset(GetDstScreen(), 58, 64000); TextStringAt(125, 50, "Save as:"); TextGoto(125, 50 + TextHeight()); TextChar('\020'); TextString(filename); TextChar('\021'); vsync(); CopyToScreen(); c = GetKey(); switch (c) { case ENTER: if (!filename[0]) break; if (asCode) { SaveCampaignAsC(filename, name, &campaign); } else { SaveCampaign(filename, &campaign); } fileChanged = 0; return; case ESCAPE: return; case BACKSPACE: if (filename[0]) filename[strlen(filename) - 1] = 0; break; default: if (strlen(filename) == sizeof(filename) - 1) break; c = toupper(c); if ((c >= 'A' && c <= 'Z') || c == '-' || c == '_' || c == '\\') { i = strlen(filename); filename[i + 1] = 0; filename[i] = c; } } } }
static void DisplaySummary() { int i, y, x, x2; char sScore[20]; unsigned char *scr = GetDstScreen(); unsigned char color; y = SCREEN_HEIGHT - 5 - TextHeight(); // 10 pixels from bottom for (i = 0; i < gMission.missionData->objectiveCount; i++) { if (gMission.objectives[i].required > 0 || gMission.objectives[i].done > 0) { // Objective color dot color = gMission.objectives[i].color; x = 5; Draw_Rect(x, (y + 3), 2, 2, color); x += 5; x2 = x + TextWidth(gMission.missionData->objectives[i].description) + 5; sprintf(sScore, "(%d)", gMission.objectives[i].done); if (gMission.objectives[i].required <= 0) { TextStringWithTableAt(x, y, gMission.missionData->objectives[i].description, &tablePurple); TextStringWithTableAt(x2, y, sScore, &tablePurple); } else if (gMission.objectives[i].done >= gMission.objectives[i].required) { TextStringWithTableAt(x, y, gMission.missionData->objectives[i].description, &tableFlamed); TextStringWithTableAt(x2, y, sScore, &tableFlamed); } else { TextStringAt(x, y, gMission.missionData->objectives[i].description); TextStringAt(x2, y, sScore); } y -= (TextHeight() + 1); } } }
static int TemplateSelection(int loadFlag, int x, int index, struct PlayerData *data, int cmd) { int i; int y; static int selection[2] = { 0, 0 }; if (cmd & CMD_BUTTON1) { if (loadFlag) UseTemplate(index, data, &templates[selection[index]]); else SaveTemplate(data, &templates[selection[index]]); PlaySound(rand() % SND_COUNT, 0, 255); return 0; } else if (cmd & CMD_BUTTON2) { PlaySound(rand() % SND_COUNT, 0, 255); return 0; } else if (cmd & (CMD_LEFT | CMD_UP)) { if (selection[index] > 0) { selection[index]--; PlaySound(SND_SWITCH, 0, 255); } else if (selection[index] == 0) { selection[index] = MAX_TEMPLATE - 1; PlaySound(SND_SWITCH, 0, 255); } } else if (cmd & (CMD_RIGHT | CMD_DOWN)) { if (selection[index] < MAX_TEMPLATE - 1) { selection[index]++; PlaySound(SND_SWITCH, 0, 255); } else if (selection[index] == MAX_TEMPLATE - 1) { selection[index] = 0; PlaySound(SND_SWITCH, 0, 255); } } y = CenterY((TextHeight() * MAX_TEMPLATE)); if (!loadFlag) { TextStringAt(x, y - 4 - TextHeight(), "Save "); TextString(data->name); TextString("..."); } for (i = 0; i < MAX_TEMPLATE; i++) DisplayMenuItem(x, y + i * TextHeight(), templates[i].name, i == selection[index]); return 1; }
void DisplayPlayer(int x, struct PlayerData *data, int character, int editingName) { struct CharacterDescription *cd; TOffsetPic body, head; char s[22]; int y; y = (SCREEN_HEIGHT / 10); cd = &characterDesc[character]; if (editingName) { sprintf(s, "%c%s%c", '\020', data->name, '\021'); TextStringAt(x, y, s); } else TextStringAt(x, y, data->name); body.dx = cBodyOffset[cd->unarmedBodyPic][DIRECTION_DOWN].dx; body.dy = cBodyOffset[cd->unarmedBodyPic][DIRECTION_DOWN].dy; body.picIndex = cBodyPic[cd->unarmedBodyPic][DIRECTION_DOWN][STATE_IDLE]; head.dx = cNeckOffset[cd->unarmedBodyPic][DIRECTION_DOWN].dx + cHeadOffset[cd->facePic][DIRECTION_DOWN].dx; head.dy = cNeckOffset[cd->unarmedBodyPic][DIRECTION_DOWN].dy + cHeadOffset[cd->facePic][DIRECTION_DOWN].dy; head.picIndex = cHeadPic[cd->facePic][DIRECTION_DOWN][STATE_IDLE]; DrawTTPic(x + 20 + body.dx, y + 36 + body.dy, gPics[body.picIndex], cd->table, gRLEPics[body.picIndex]); DrawTTPic(x + 20 + head.dx, y + 36 + head.dy, gPics[head.picIndex], cd->table, gRLEPics[head.picIndex]); }
static int DisplayPage(const char *title, int index, struct Entry *e, int hilite1, int hilite2) { int x = 80; int y = 5; TextStringAt(5, 5, title); while (index < MAX_ENTRY && e[index].score > 0 && x < 300) { y += DisplayEntry(x, y, index, &e[index], index == hilite1 || index == hilite2); if (y > 198 - TextHeight()) { y = 20; x += 100; } index++; } CopyToScreen(); return index; }
void TextStringSpecial(const char *s, unsigned int opts, unsigned int xpad, unsigned int ypad) { int scrw = SCREEN_WIDTH; int scrh = SCREEN_HEIGHT; int x, y, w, h; x = y = w = h = 0; w = TextWidth(s); h = TextHeight(); if (FLAG_SET(opts, TEXT_XCENTER)) { x = (scrw - w) / 2; } if (FLAG_SET(opts, TEXT_YCENTER)) { y = (scrh - h) / 2; } if (FLAG_SET(opts, TEXT_LEFT)) { x = 0 + xpad; } if (FLAG_SET(opts, TEXT_RIGHT)) { x = scrw - w - xpad; } if (FLAG_SET(opts, TEXT_TOP)) { y = 0 + ypad; } if (FLAG_SET(opts, TEXT_BOTTOM)) { y = scrh - h - ypad; } if (FLAG_SET(opts, TEXT_FLAMED)) { TextStringWithTableAt(x, y, s, &tableFlamed); } else if (FLAG_SET(opts, TEXT_PURPLE)) { TextStringWithTableAt(x, y, s, &tablePurple); } else { TextStringAt(x, y, s); } }
static void DisplayKeys(int x, int x2, int y, char *title, struct PlayerData *data, int index, int change) { int i; TextStringAt(x, y, title); TextStringAt(x, y + TextHeight(), "Left"); TextStringAt(x, y + 2 * TextHeight(), "Right"); TextStringAt(x, y + 3 * TextHeight(), "Up"); TextStringAt(x, y + 4 * TextHeight(), "Down"); TextStringAt(x, y + 5 * TextHeight(), "Fire"); TextStringAt(x, y + 6 * TextHeight(), "Switch/slide"); for (i = 0; i < 6; i++) if (change == i) DisplayMenuItem(x2, y + (i + 1) * TextHeight(), SELECTKEY, index == i); else DisplayMenuItem(x2, y + (i + 1) * TextHeight(), SDL_GetKeyName(data->keys[i]), index == i); }
static void Display(TCampaignSetting * setting, int index, int xc, int yc) { int x, y = 10; char s[50]; const TBadGuy *b; int i; memset(GetDstScreen(), 74, SCREEN_MEMSIZE); sprintf(s, "%d/%d", setting->characterCount, MAX_CHARACTERS); TextStringAt(10, 190, s); if (index >= 0 && index < setting->characterCount) { b = &setting->characters[index]; DisplayText(30, y, "Face", yc == YC_APPEARANCE && xc == XC_FACE); DisplayText(60, y, "Skin", yc == YC_APPEARANCE && xc == XC_SKIN); DisplayText(90, y, "Hair", yc == YC_APPEARANCE && xc == XC_HAIR); DisplayText(120, y, "Body", yc == YC_APPEARANCE && xc == XC_BODY); DisplayText(150, y, "Arms", yc == YC_APPEARANCE && xc == XC_ARMS); DisplayText(180, y, "Legs", yc == YC_APPEARANCE && xc == XC_LEGS); y += TextHeight(); sprintf(s, "Speed: %d%%", (100 * b->speed) / 256); DisplayText(20, y, s, yc == YC_ATTRIBUTES && xc == XC_SPEED); sprintf(s, "Hp: %d", b->health); DisplayText(70, y, s, yc == YC_ATTRIBUTES && xc == XC_HEALTH); sprintf(s, "Move: %d%%", b->probabilityToMove); DisplayText(120, y, s, yc == YC_ATTRIBUTES && xc == XC_MOVE); sprintf(s, "Track: %d%%", b->probabilityToTrack); DisplayText(170, y, s, yc == YC_ATTRIBUTES && xc == XC_TRACK); sprintf(s, "Shoot: %d%%", b->probabilityToShoot); DisplayText(220, y, s, yc == YC_ATTRIBUTES && xc == XC_SHOOT); sprintf(s, "Delay: %d", b->actionDelay); DisplayText(270, y, s, yc == YC_ATTRIBUTES && xc == XC_DELAY); y += TextHeight(); DisplayFlag(5, y, "Asbestos", (b->flags & FLAGS_ASBESTOS) != 0, yc == YC_FLAGS && xc == XC_ASBESTOS); DisplayFlag(50, y, "Immunity", (b->flags & FLAGS_IMMUNITY) != 0, yc == YC_FLAGS && xc == XC_IMMUNITY); DisplayFlag(95, y, "C-thru", (b->flags & FLAGS_SEETHROUGH) != 0, yc == YC_FLAGS && xc == XC_SEETHROUGH); DisplayFlag(140, y, "Run-away", (b->flags & FLAGS_RUNS_AWAY) != 0, yc == YC_FLAGS && xc == XC_RUNS_AWAY); DisplayFlag(185, y, "Sneaky", (b->flags & FLAGS_SNEAKY) != 0, yc == YC_FLAGS && xc == XC_SNEAKY); DisplayFlag(230, y, "Good guy", (b->flags & FLAGS_GOOD_GUY) != 0, yc == YC_FLAGS && xc == XC_GOOD_GUY); DisplayFlag(275, y, "Asleep", (b->flags & FLAGS_SLEEPALWAYS) != 0, yc == YC_FLAGS && xc == XC_SLEEPING); y += TextHeight(); DisplayFlag(5, y, "Prisoner", (b->flags & FLAGS_PRISONER) != 0, yc == YC_FLAGS2 && xc == XC_PRISONER); DisplayFlag(50, y, "Invuln.", (b->flags & FLAGS_INVULNERABLE) != 0, yc == YC_FLAGS2 && xc == XC_INVULNERABLE); DisplayFlag(95, y, "Follower", (b->flags & FLAGS_FOLLOWER) != 0, yc == YC_FLAGS2 && xc == XC_FOLLOWER); DisplayFlag(140, y, "Penalty", (b->flags & FLAGS_PENALTY) != 0, yc == YC_FLAGS2 && xc == XC_PENALTY); DisplayFlag(185, y, "Victim", (b->flags & FLAGS_VICTIM) != 0, yc == YC_FLAGS2 && xc == XC_VICTIM); DisplayFlag(230, y, "Awake", (b->flags & FLAGS_AWAKEALWAYS) != 0, yc == YC_FLAGS2 && xc == XC_AWAKE); y += TextHeight(); DisplayText(50, y, gunDesc[b->gun].gunName, yc == YC_WEAPON); y += TextHeight() + 5; x = 10; for (i = 0; i < setting->characterCount; i++) { DisplayCharacter(x, y + 20, &setting->characters[i], index == i); x += 20; if (x > SCREEN_WIDTH) { x = 10; y += 30; } } } CopyToScreen(); }
void Display(int index, int xc, int yc, int key) { char s[128]; int y = 5; int i; SetSecondaryMouseRects(NULL); memset(GetDstScreen(), 58, 64000); sprintf(s, "Key: 0x%x", key); TextStringAt(270, 190, s); DisplayText(25, y, campaign.title, yc == YC_CAMPAIGNTITLE && xc == XC_CAMPAIGNTITLE, 1); if (fileChanged) DrawTPic(10, y, gPics[221], NULL); if (currentMission) { sprintf(s, "Mission %d/%d", index + 1, campaign.missionCount); DisplayText(270, y, s, yc == YC_MISSIONINDEX, 0); y += TextHeight() + 3; DisplayText(25, y, currentMission->title, yc == YC_MISSIONTITLE && xc == XC_MISSIONTITLE, 1); y += TextHeight() + 2; sprintf(s, "Width: %d", currentMission->mapWidth); DisplayText(20, y, s, yc == YC_MISSIONPROPS && xc == XC_WIDTH, 0); sprintf(s, "Height: %d", currentMission->mapHeight); DisplayText(60, y, s, yc == YC_MISSIONPROPS && xc == XC_HEIGHT, 0); sprintf(s, "Walls: %d", currentMission->wallCount); DisplayText(100, y, s, yc == YC_MISSIONPROPS && xc == XC_WALLCOUNT, 0); sprintf(s, "Len: %d", currentMission->wallLength); DisplayText(140, y, s, yc == YC_MISSIONPROPS && xc == XC_WALLLENGTH, 0); sprintf(s, "Rooms: %d", currentMission->roomCount); DisplayText(180, y, s, yc == YC_MISSIONPROPS && xc == XC_ROOMCOUNT, 0); sprintf(s, "Sqr: %d", currentMission->squareCount); DisplayText(220, y, s, yc == YC_MISSIONPROPS && xc == XC_SQRCOUNT, 0); sprintf(s, "Dens: %d", currentMission->baddieDensity); DisplayText(260, y, s, yc == YC_MISSIONPROPS && xc == XC_DENSITY, 0); y += TextHeight(); DisplayText(20, y, "Wall", yc == YC_MISSIONLOOKS && xc == XC_WALL, 0); DisplayText(50, y, "Floor", yc == YC_MISSIONLOOKS && xc == XC_FLOOR, 0); DisplayText(80, y, "Rooms", yc == YC_MISSIONLOOKS && xc == XC_ROOM, 0); DisplayText(110, y, "Doors", yc == YC_MISSIONLOOKS && xc == XC_DOORS, 0); DisplayText(140, y, "Keys", yc == YC_MISSIONLOOKS && xc == XC_KEYS, 0); DisplayText(170, y, "Exit", yc == YC_MISSIONLOOKS && xc == XC_EXIT, 0); sprintf(s, "Walls: %s", RangeName(currentMission->wallRange)); DisplayText(200, y, s, yc == YC_MISSIONLOOKS && xc == XC_COLOR1, 0); sprintf(s, "Floor: %s", RangeName(currentMission->floorRange)); DisplayText(200, y + TH, s, yc == YC_MISSIONLOOKS && xc == XC_COLOR2, 0); sprintf(s, "Rooms: %s", RangeName(currentMission->roomRange)); DisplayText(200, y + 2 * TH, s, yc == YC_MISSIONLOOKS && xc == XC_COLOR3, 0); sprintf(s, "Extra: %s", RangeName(currentMission->altRange)); DisplayText(200, y + 3 * TH, s, yc == YC_MISSIONLOOKS && xc == XC_COLOR4, 0); DrawPic(20, y + TH, gPics[cWallPics [currentMission->wallStyle % WALL_COUNT][WALL_SINGLE]], NULL); DrawPic(50, y + TH, gPics[cFloorPics [currentMission->floorStyle % FLOOR_COUNT][FLOOR_NORMAL]], NULL); DrawPic(80, y + TH, gPics[cRoomPics [currentMission->roomStyle % ROOMFLOOR_COUNT][ROOMFLOOR_NORMAL]], NULL); DrawPic(110, y + TH, gPics[cGeneralPics[gMission.doorPics[0].horzPic]. picIndex], NULL); DrawTPic(140, y + TH, gPics[cGeneralPics[gMission.keyPics[0]].picIndex], NULL); DrawPic(170, y + TH, gPics[gMission.exitPic], NULL); y += TH + 25; DisplayText(20, y, "Mission description", yc == YC_MISSIONDESC, 0); y += TextHeight(); sprintf(s, "Characters (%d/%d)", currentMission->baddieCount, BADDIE_MAX); DisplayText(20, y, s, yc == YC_CHARACTERS, 0); y += TextHeight(); sprintf(s, "Mission objective characters (%d/%d)", currentMission->specialCount, SPECIAL_MAX); DisplayText(20, y, s, yc == YC_SPECIALS, 0); y += TextHeight(); sprintf(s, "Available weapons (%d/%d)", gMission.weaponCount, WEAPON_MAX); DisplayText(20, y, s, yc == YC_WEAPONS, 0); y += TextHeight(); sprintf(s, "Map items (%d/%d)", gMission.objectCount, ITEMS_MAX); DisplayText(20, y, s, yc == YC_ITEMS, 0); y += TextHeight() + 2; if (currentMission->objectiveCount) { for (i = 0; i < currentMission->objectiveCount; i++) { DisplayText(20, y, currentMission->objectives[i]. description, yc - YC_OBJECTIVES == i, 1); y += TextHeight(); } } else DisplayText(20, y, "-- mission objectives --", yc == YC_OBJECTIVES, 0); } else if (campaign.missionCount) { sprintf(s, "End/%d", campaign.missionCount); DisplayText(270, y, s, yc == YC_MISSIONINDEX, 0); } y = 170; switch (yc) { case YC_CAMPAIGNTITLE: DisplayText(20, 150, campaign.author, yc == YC_CAMPAIGNTITLE && xc == XC_AUTHOR, 1); MissionDescription(150 + TH, campaign.description, yc == YC_CAMPAIGNTITLE && xc == XC_CAMPAIGNDESC); SetSecondaryMouseRects(localCampaignClicks); break; case YC_MISSIONTITLE: DisplayText(20, 150, currentMission->song, yc == YC_MISSIONTITLE && xc == XC_MUSICFILE, 1); SetSecondaryMouseRects(localMissionClicks); break; case YC_MISSIONDESC: MissionDescription(150, currentMission->description, yc == YC_MISSIONDESC); break; case YC_CHARACTERS: TextStringAt(5, 190, "Use Insert, Delete and PageUp/PageDown"); if (!currentMission) break; for (i = 0; i < currentMission->baddieCount; i++) DisplayCharacter(20 + 20 * i, y, CHARACTER_OTHERS + i, xc == i); SetSecondaryMouseRects(localCharacterClicks); break; case YC_SPECIALS: TextStringAt(5, 190, "Use Insert, Delete and PageUp/PageDown"); if (!currentMission) break; for (i = 0; i < currentMission->specialCount; i++) DisplayCharacter(20 + 20 * i, y, CHARACTER_OTHERS + currentMission->baddieCount + i, xc == i); SetSecondaryMouseRects(localCharacterClicks); break; case YC_ITEMS: TextStringAt(5, 190, "Use Insert, Delete and PageUp/PageDown"); if (!currentMission) break; for (i = 0; i < currentMission->itemCount; i++) DisplayMapItem(10 + 20 * i, y, gMission.mapObjects[i], currentMission->itemDensity[i], xc == i); break; case YC_WEAPONS: if (!currentMission) break; ListWeapons(150, xc); break; default: if (currentMission && yc >= YC_OBJECTIVES && yc - YC_OBJECTIVES < currentMission->objectiveCount) { TextStringAt(5, 190, "Use Insert, Delete and PageUp/PageDown"); DrawObjectiveInfo(yc - YC_OBJECTIVES, y, xc); } break; } vsync(); CopyToScreen(); }
int SelectVolume(int cmd) { static int index = 0; char s[10]; int x, y; if (cmd == CMD_ESC) return MODE_MAIN; if (AnyButton(cmd) && index == VOLUME_COUNT - 1) return MODE_MAIN; if (Left(cmd)) { switch (index) { case 0: if (FXVolume() > 8) SetFXVolume(FXVolume() - 8); break; case 1: if (MusicVolume() > 8) SetMusicVolume(MusicVolume() - 8); break; case 2: if (FXChannels() > 2) SetFXChannels(FXChannels() - 2); break; case 3: break; } PlaySound(SND_SWITCH, 0, 255); } else if (Right(cmd)) { switch (index) { case 0: if (FXVolume() < 64) SetFXVolume(FXVolume() + 8); break; case 1: if (MusicVolume() < 64) SetMusicVolume(MusicVolume() + 8); break; case 2: if (FXChannels() < 8) SetFXChannels(FXChannels() + 2); break; case 3: break; } PlaySound(SND_SWITCH, 0, 255); } else if (Up(cmd)) { index--; if (index < 0) index = VOLUME_COUNT - 1; PlaySound(SND_SWITCH, 0, 255); } else if (Down(cmd)) { index++; if (index >= VOLUME_COUNT) index = 0; PlaySound(SND_SWITCH, 0, 255); } TextStringSpecial("Configure Sound:", TEXT_XCENTER | TEXT_TOP, 0, (SCREEN_WIDTH / 12)); x = CenterX(MenuWidth(volumeMenu, VOLUME_COUNT)); y = CenterY(MenuHeight(volumeMenu, VOLUME_COUNT)); DisplayMenuAt(x - 20, y, volumeMenu, VOLUME_COUNT, index); x += MenuWidth(volumeMenu, VOLUME_COUNT); x += 10; sprintf(s, "%d", FXVolume() / 8); TextStringAt(x, y, s); sprintf(s, "%d", MusicVolume() / 8); TextStringAt(x, y + TextHeight(), s); sprintf(s, "%d", FXChannels()); TextStringAt(x, y + 2 * TextHeight(), s); TextStringAt(x, y + 3 * TextHeight(), "No"); return MODE_VOLUME; }
int SelectControls(int cmd) { static int index = 0; int x, y; if (cmd == CMD_ESC) return MODE_MAIN; if (AnyButton(cmd) || Left(cmd) || Right(cmd)) { PlaySound(rand() % SND_COUNT, 0, 255); switch (index) { case 0: ChangeControl(&gPlayer1Data, &gPlayer2Data); break; case 1: ChangeControl(&gPlayer2Data, &gPlayer1Data); break; case 2: gOptions.swapButtonsJoy1 = !gOptions.swapButtonsJoy1; break; case 3: gOptions.swapButtonsJoy2 = !gOptions.swapButtonsJoy2; break; case 4: return MODE_KEYS; case 5: InitSticks(); AutoCalibrate(); break; default: return MODE_MAIN; } } if (Up(cmd)) { index--; if (index < 0) index = CONTROLS_COUNT - 1; PlaySound(SND_SWITCH, 0, 255); } else if (Down(cmd)) { index++; if (index >= CONTROLS_COUNT) index = 0; PlaySound(SND_SWITCH, 0, 255); } TextStringSpecial("Configure Controls:", TEXT_XCENTER | TEXT_TOP, 0, (SCREEN_WIDTH / 12)); x = CenterX(MenuWidth(controlsMenu, CONTROLS_COUNT)); y = CenterY(MenuHeight(controlsMenu, CONTROLS_COUNT)); DisplayMenuAt(x - 20, y, controlsMenu, CONTROLS_COUNT, index); x += MenuWidth(controlsMenu, CONTROLS_COUNT); x += 10; DisplayControl(x, y, gPlayer1Data.controls); DisplayControl(x, y + TextHeight(), gPlayer2Data.controls); TextStringAt(x, y + 2 * TextHeight(), gOptions.swapButtonsJoy1 ? "Yes" : "No"); TextStringAt(x, y + 3 * TextHeight(), gOptions.swapButtonsJoy2 ? "Yes" : "No"); return MODE_CONTROLS; }
int SelectOptions(int cmd) { static int index = 0; char s[10]; int x, y; if (cmd == CMD_ESC) return MODE_MAIN; if (AnyButton(cmd) || Left(cmd) || Right(cmd)) { switch (index) { case 0: gOptions.playersHurt = !gOptions.playersHurt; PlaySound(SND_KILL, 0, 255); break; case 1: gOptions.displayFPS = !gOptions.displayFPS; PlaySound(SND_FLAMER, 0, 255); break; case 2: gOptions.displayTime = !gOptions.displayTime; PlaySound(SND_LAUNCH, 0, 255); break; case 3: if (gOptions.copyMode == COPY_REPMOVSD) gOptions.copyMode = COPY_DEC_JNZ; else gOptions.copyMode = COPY_REPMOVSD; PlaySound(SND_EXPLOSION, 0, 255); break; case 4: if (Left(cmd) && gOptions.brightness > -10) gOptions.brightness--; else if (Right(cmd) && gOptions.brightness < 10) gOptions.brightness++; else break; PlaySound(SND_POWERGUN, 0, 255); PaletteAdjust(); break; case 5: if (gOptions.xSplit == 0) { gOptions.xSplit = SPLIT_X; gOptions.ySplit = SPLIT_Y; } else { gOptions.xSplit = gOptions.ySplit = 0; } PlaySound(SND_KILL3, 0, 255); break; case 6: if (Left(cmd)) { if (Button1(cmd) && Button2(cmd)) gCampaign.seed -= 1000; else if (Button1(cmd)) gCampaign.seed -= 10; else if (Button2(cmd)) gCampaign.seed -= 100; else gCampaign.seed--; } else if (Right(cmd)) { if (Button1(cmd) && Button2(cmd)) gCampaign.seed += 1000; else if (Button1(cmd)) gCampaign.seed += 10; else if (Button2(cmd)) gCampaign.seed += 100; else gCampaign.seed++; } break; case 7: if (Left(cmd)) { if (gOptions.difficulty > DIFFICULTY_VERYEASY) gOptions.difficulty--; } else if (Right(cmd)) { if (gOptions.difficulty < DIFFICULTY_VERYHARD) gOptions.difficulty++; } if (gOptions.difficulty > DIFFICULTY_VERYHARD) gOptions.difficulty = DIFFICULTY_VERYHARD; if (gOptions.difficulty < DIFFICULTY_VERYEASY) gOptions.difficulty = DIFFICULTY_VERYEASY; break; case 8: gOptions.slowmotion = !gOptions.slowmotion; break; case 9: if (Left(cmd)) { if (gOptions.density > 25) gOptions.density -= 25; } else if (Right(cmd)) { if (gOptions.density < 200) gOptions.density += 25; } break; case 10: if (Left(cmd)) { if (gOptions.npcHp > 25) gOptions.npcHp -= 25; } else if (Right(cmd)) { if (gOptions.npcHp < 200) gOptions.npcHp += 25; } break; case 11: if (Left(cmd)) { if (gOptions.playerHp > 25) gOptions.playerHp -= 25; } else if (Right(cmd)) { if (gOptions.playerHp < 200) gOptions.playerHp += 25; } break; case 12: Gfx_HintToggle(HINT_FULLSCREEN); InitVideo(); break; case 13: { GFX_Mode *m = NULL; if (Left(cmd)) { m = Gfx_ModePrev(); } else if (Right(cmd)) { m = Gfx_ModeNext(); } if (m) { debug(D_NORMAL, "new mode? %d x %d\n", m->w, m->h); Gfx_SetHint(HINT_WIDTH, m->w); Gfx_SetHint(HINT_HEIGHT, m->h); } } break; case 14: { int fac = Gfx_GetHint(HINT_SCALEFACTOR); if (Left(cmd)) { fac--; } else if (Right(cmd)) { fac++; } if (fac >= 1 && fac <= 4) { Gfx_SetHint(HINT_SCALEFACTOR, (const int)fac); InitVideo(); } } break; default: PlaySound(SND_BANG, 0, 255); return MODE_MAIN; } } if (Up(cmd)) { index--; if (index < 0) index = OPTIONS_COUNT - 1; PlaySound(SND_SWITCH, 0, 255); } else if (Down(cmd)) { index++; if (index >= OPTIONS_COUNT) index = 0; PlaySound(SND_SWITCH, 0, 255); } TextStringSpecial("Game Options:", TEXT_XCENTER | TEXT_TOP, 0, (SCREEN_WIDTH / 12)); x = CenterX(MenuWidth(optionsMenu, OPTIONS_COUNT)); y = CenterY(MenuHeight(optionsMenu, OPTIONS_COUNT)); DisplayMenuAt(x - 20, y, optionsMenu, OPTIONS_COUNT, index); x += MenuWidth(optionsMenu, OPTIONS_COUNT); x += 10; TextStringAt(x, y, gOptions.playersHurt ? "Yes" : "No"); TextStringAt(x, y + TextHeight(), gOptions.displayFPS ? "On" : "Off"); TextStringAt(x, y + 2 * TextHeight(), gOptions.displayTime ? "On" : "Off"); TextStringAt(x, y + 3 * TextHeight(), gOptions.copyMode == COPY_REPMOVSD ? "rep movsd" : "dec/jnz"); sprintf(s, "%d", gOptions.brightness); TextStringAt(x, y + 4 * TextHeight(), s); TextStringAt(x, y + 5 * TextHeight(), gOptions.xSplit ? "No" : "Yes"); sprintf(s, "%u", gCampaign.seed); TextStringAt(x, y + 6 * TextHeight(), s); switch (gOptions.difficulty) { case DIFFICULTY_VERYEASY: strcpy(s, "Easiest"); break; case DIFFICULTY_EASY: strcpy(s, "Easy"); break; case DIFFICULTY_HARD: strcpy(s, "Hard"); break; case DIFFICULTY_VERYHARD: strcpy(s, "Very hard"); break; default: strcpy(s, "Normal"); break; } TextStringAt(x, y + 7 * TextHeight(), s); TextStringAt(x, y + 8 * TextHeight(), gOptions.slowmotion ? "Yes" : "No"); sprintf(s, "%u%%", gOptions.density); TextStringAt(x, y + 9 * TextHeight(), s); sprintf(s, "%u%%", gOptions.npcHp); TextStringAt(x, y + 10 * TextHeight(), s); sprintf(s, "%u%%", gOptions.playerHp); TextStringAt(x, y + 11 * TextHeight(), s); sprintf(s, "%s", Gfx_GetHint(HINT_FULLSCREEN) ? "Yes" : "No"); TextStringAt(x, y + 12 * TextHeight(), s); sprintf(s, "%dx%d", Gfx_GetHint(HINT_WIDTH), Gfx_GetHint(HINT_HEIGHT)); TextStringAt(x, y + 13 * TextHeight(), s); sprintf(s, "%dx", Gfx_GetHint(HINT_SCALEFACTOR)); TextStringAt(x, y + 14 * TextHeight(), s); return MODE_OPTIONS; }