1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 10:09:43 +01:00

Turn (super)patrons/githubfriends into arrays & move them to new file

So, originally, I wanted to keep them on Game, but it turns out that if
I initialize it in Game.cpp, the compiler will complain that other files
won't know what's actually inside the array. To do that, I'd have to
initialize it in Game.h. But I don't want to initialize it in Game.h
because that'd mean recompiling a lot of unnecessary files whenever
someone gets added to the credits.

So, I moved all the patrons, superpatrons, and GitHub contributors to a
new file, Credits.h, which only contains the list (and the credits max
position calculation). That way, whenever someone gets added, only the
minimal amount of files need to be recompiled.
This commit is contained in:
Misa 2020-07-03 03:13:15 -07:00 committed by Ethan Lee
parent a80502bdc9
commit fc03fca838
6 changed files with 143 additions and 137 deletions

View file

@ -0,0 +1,118 @@
#ifndef CREDITS_H
#define CREDITS_H
#include <SDL.h>
namespace Credits {
/* Terry's Patrons... */
static const char* superpatrons[] = {
"Anders Ekermo",
"Andreas K|mper",
"Anthony Burch",
"Bennett Foddy",
"Brendan O'Sullivan",
"Christopher Armstrong",
"Daniel Benmergui",
"David Pittman",
"Ian Bogost",
"Ian Poma",
"Jaz McDougall",
"John Faulkenbury",
"Jonathan Whiting",
"Kyle Pulver",
"Markus Persson",
"Nathan Ostgard",
"Nick Easler",
"Stephen Lavelle",
};
static const char* patrons[] = {
"Adam Wendt",
"Andreas J{rgensen",
"}ngel Louzao Penalva",
"Ashley Burton",
"Aubrey Hesselgren",
"Bradley Rose",
"Brendan Urquhart",
"Chris Ayotte",
"Christopher Zamanillo",
"Daniel Schuller",
"Hybrid Mind Studios",
"Emilie McGinley",
"Francisco Solares",
"Hal Helms",
"Hayden Scott-Baron",
"Hermit Games",
"Ido Yehieli",
"Jade Vault Games",
"James Andrews",
"James Riley",
"James Hsieh",
"Jasper Byrne",
"Jedediah Baker",
"Jens Bergensten",
"Jeremy J. Penner",
"Jeremy Peterson",
"Jim McGinley",
"Jonathan Cartwright",
"John Nesky",
"Jos Yule",
"Jose Flores",
"Josh Bizeau",
"Joshua Buergel",
"Joshua Hochner",
"Kurt Ostfeld",
"Magnus P~lsson",
"Mark Neschadimenko",
"Matt Antonellis",
"Matthew Reppert",
"Michael Falkensteiner",
"Michael Vendittelli",
"Mike Kasprzak",
"Mitchel Stein",
"Sean Murray",
"Simon Michael",
"Simon Schmid",
"Stephen Maxwell",
"Swing Swing Submarine",
"Tam Toucan",
"Terry Dooher",
"Tim W.",
"Timothy Bragan",
};
/* CONTRIBUTORS.txt, again listed alphabetically (according to `sort`) by last name */
static const char* githubfriends[] = {
"Matt \"Fussmatte\" Aaldenberg", // TODO: Change to "Fußmatte" if/when UTF-8 support is added
"AlexApps99",
"Christoph B{hmwalder",
"Charlie Bruce",
"Brian Callahan",
"Dav999",
"Allison Fleischer",
"Daniel Lee",
"Fredrik Ljungdahl",
"Matt Penny",
"Elliott Saltar",
"Marvin Scholz",
"Keith Stellyes",
"Elijah Stone",
"Thomas S|nger",
"Info Teddy",
"Alexandra Tildea",
"leo60228",
"Emmanuel Vadot",
"Remi Verschelde", // TODO: Change to "Rémi" if/when UTF-8 support is added
"viri",
"Wouter",
};
/* Calculate credits length, finally. */
static const int creditmaxposition = 1050 + (10 * (
SDL_arraysize(superpatrons) + SDL_arraysize(patrons) + SDL_arraysize(githubfriends)
));
}; /* namespace Credits */
#endif /* CREDITS_H */

View file

@ -403,117 +403,6 @@ void Game::init(void)
shouldreturntopausemenu = false;
disablepause = false;
/* Terry's Patrons... */
const char* superpatrons_arr[] = {
"Anders Ekermo",
"Andreas K|mper",
"Anthony Burch",
"Bennett Foddy",
"Brendan O'Sullivan",
"Christopher Armstrong",
"Daniel Benmergui",
"David Pittman",
"Ian Bogost",
"Ian Poma",
"Jaz McDougall",
"John Faulkenbury",
"Jonathan Whiting",
"Kyle Pulver",
"Markus Persson",
"Nathan Ostgard",
"Nick Easler",
"Stephen Lavelle",
};
superpatrons.insert(superpatrons.end(), superpatrons_arr, superpatrons_arr + sizeof(superpatrons_arr)/sizeof(superpatrons_arr[0]));
const char* patrons_arr[] = {
"Adam Wendt",
"Andreas J{rgensen",
"}ngel Louzao Penalva",
"Ashley Burton",
"Aubrey Hesselgren",
"Bradley Rose",
"Brendan Urquhart",
"Chris Ayotte",
"Christopher Zamanillo",
"Daniel Schuller",
"Hybrid Mind Studios",
"Emilie McGinley",
"Francisco Solares",
"Hal Helms",
"Hayden Scott-Baron",
"Hermit Games",
"Ido Yehieli",
"Jade Vault Games",
"James Andrews",
"James Riley",
"James Hsieh",
"Jasper Byrne",
"Jedediah Baker",
"Jens Bergensten",
"Jeremy J. Penner",
"Jeremy Peterson",
"Jim McGinley",
"Jonathan Cartwright",
"John Nesky",
"Jos Yule",
"Jose Flores",
"Josh Bizeau",
"Joshua Buergel",
"Joshua Hochner",
"Kurt Ostfeld",
"Magnus P~lsson",
"Mark Neschadimenko",
"Matt Antonellis",
"Matthew Reppert",
"Michael Falkensteiner",
"Michael Vendittelli",
"Mike Kasprzak",
"Mitchel Stein",
"Sean Murray",
"Simon Michael",
"Simon Schmid",
"Stephen Maxwell",
"Swing Swing Submarine",
"Tam Toucan",
"Terry Dooher",
"Tim W.",
"Timothy Bragan",
};
patrons.insert(patrons.end(), patrons_arr, patrons_arr + sizeof(patrons_arr)/sizeof(patrons_arr[0]));
/* CONTRIBUTORS.txt, again listed alphabetically (according to `sort`) by last name */
const char* githubfriends_arr[] = {
"Matt \"Fussmatte\" Aaldenberg", // TODO: Change to "Fußmatte" if/when UTF-8 support is added
"AlexApps99",
"Christoph B{hmwalder",
"Charlie Bruce",
"Brian Callahan",
"Dav999",
"Allison Fleischer",
"Daniel Lee",
"Fredrik Ljungdahl",
"Matt Penny",
"Elliott Saltar",
"Marvin Scholz",
"Keith Stellyes",
"Elijah Stone",
"Thomas S|nger",
"Info Teddy",
"Alexandra Tildea",
"leo60228",
"Emmanuel Vadot",
"Remi Verschelde", // TODO: Change to "Rémi" if/when UTF-8 support is added
"viri",
"Wouter",
};
githubfriends.insert(githubfriends.end(), githubfriends_arr, githubfriends_arr + sizeof(githubfriends_arr)/sizeof(githubfriends_arr[0]));
/* Calculate credits length, finally. */
creditmaxposition = 1050 + (10 * (
superpatrons.size() + patrons.size() + githubfriends.size()
));
}
Game::~Game(void)

View file

@ -269,10 +269,6 @@ public:
int creditposition;
int oldcreditposition;
int creditmaxposition;
std::vector<const char*> superpatrons;
std::vector<const char*> patrons;
std::vector<const char*> githubfriends;
bool insecretlab;
bool inintermission;

View file

@ -1,6 +1,7 @@
#include "Input.h"
#include "Logic.h"
#include "Script.h"
#include "Credits.h"
#include "MakeAndPlay.h"
@ -899,7 +900,7 @@ void menuactionpress()
music.playef(11);
game.current_credits_list_index += 9;
if (game.current_credits_list_index >= (int)game.superpatrons.size())
if (game.current_credits_list_index >= (int)SDL_arraysize(Credits::superpatrons))
{
// No more super patrons. Move to the next credits section
game.current_credits_list_index = 0;
@ -950,7 +951,7 @@ void menuactionpress()
music.playef(11);
game.current_credits_list_index += 14;
if (game.current_credits_list_index >= (int)game.patrons.size())
if (game.current_credits_list_index >= (int)SDL_arraysize(Credits::patrons))
{
// No more patrons. Move to the next credits section
game.current_credits_list_index = 0;
@ -972,7 +973,7 @@ void menuactionpress()
if (game.current_credits_list_index < 0)
{
//No more patrons. Move to the previous credits section
game.current_credits_list_index = game.superpatrons.size() - 1 - (game.superpatrons.size()-1)%9;
game.current_credits_list_index = SDL_arraysize(Credits::superpatrons) - 1 - (SDL_arraysize(Credits::superpatrons)-1)%9;
game.createmenu(Menu::credits3, true);
}
else
@ -1001,7 +1002,7 @@ void menuactionpress()
music.playef(11);
game.current_credits_list_index += 9;
if (game.current_credits_list_index >= (int)game.githubfriends.size())
if (game.current_credits_list_index >= (int)SDL_arraysize(Credits::githubfriends))
{
// No more GitHub contributors. Move to the next credits section
game.current_credits_list_index = 0;
@ -1023,7 +1024,7 @@ void menuactionpress()
if (game.current_credits_list_index < 0)
{
//No more GitHub contributors. Move to the previous credits section
game.current_credits_list_index = game.patrons.size() - 1 - (game.patrons.size()-1)%14;
game.current_credits_list_index = SDL_arraysize(Credits::patrons) - 1 - (SDL_arraysize(Credits::patrons)-1)%14;
game.createmenu(Menu::credits4, true);
}
else
@ -1056,7 +1057,7 @@ void menuactionpress()
case 1:
//previous page
music.playef(11);
game.current_credits_list_index = game.githubfriends.size() - 1 - (game.githubfriends.size()-1)%9;
game.current_credits_list_index = SDL_arraysize(Credits::githubfriends) - 1 - (SDL_arraysize(Credits::githubfriends)-1)%9;
game.createmenu(Menu::credits5, true);
game.currentmenuoption = 1;
map.nexttowercolour();
@ -2434,13 +2435,13 @@ void gamecompleteinput()
if (key.isDown(KEYBOARD_z) || key.isDown(KEYBOARD_SPACE) || key.isDown(KEYBOARD_v) || key.isDown(game.controllerButton_flip))
{
game.creditposition -= 6;
if (game.creditposition <= -game.creditmaxposition)
if (game.creditposition <= -Credits::creditmaxposition)
{
if(graphics.fademode==0)
{
graphics.fademode = 2;
}
game.creditposition = -game.creditmaxposition;
game.creditposition = -Credits::creditmaxposition;
}
else
{

View file

@ -2,6 +2,7 @@
#include "Script.h"
#include "Network.h"
#include "FileSystemUtils.h"
#include "Credits.h"
void titleupdatetextcol()
{
@ -158,9 +159,9 @@ void gamecompletelogic()
if(graphics.col_tb>255) graphics.col_tb=255;
game.creditposition--;
if (game.creditposition <= -game.creditmaxposition)
if (game.creditposition <= -Credits::creditmaxposition)
{
game.creditposition = -game.creditmaxposition;
game.creditposition = -Credits::creditmaxposition;
map.bscroll = 0;
}
else if (!game.press_action)

View file

@ -7,6 +7,7 @@
#include "Map.h"
#include "Script.h"
#include "FileSystemUtils.h"
#include "Credits.h"
#include "MakeAndPlay.h"
@ -273,14 +274,14 @@ void menurender()
graphics.Print( 40, 30, "the following patrons", tr, tg, tb, true);
int startidx = game.current_credits_list_index;
int endidx = std::min(startidx + 9, (int)game.superpatrons.size());
int endidx = std::min(startidx + 9, (int)SDL_arraysize(Credits::superpatrons));
int xofs = 80 - 16;
int yofs = 40 + 20;
for (int i = startidx; i < endidx; ++i)
{
graphics.Print(xofs, yofs, game.superpatrons[i], tr, tg, tb);
graphics.Print(xofs, yofs, Credits::superpatrons[i], tr, tg, tb);
xofs += 4;
yofs += 14;
}
@ -291,7 +292,7 @@ void menurender()
graphics.Print( -1, 20, "and also by", tr, tg, tb, true);
int startidx = game.current_credits_list_index;
int endidx = std::min(startidx + 14, (int)game.patrons.size());
int endidx = std::min(startidx + 14, (int)SDL_arraysize(Credits::patrons));
int maxheight = 10 * 14;
int totalheight = (endidx - startidx) * 10;
@ -301,7 +302,7 @@ void menurender()
for (int i = startidx; i < endidx; ++i)
{
graphics.Print(80, yofs, game.patrons[i], tr, tg, tb);
graphics.Print(80, yofs, Credits::patrons[i], tr, tg, tb);
yofs += 10;
}
break;
@ -312,7 +313,7 @@ void menurender()
graphics.Print( 40, 30, "GitHub from", tr, tg, tb, true);
int startidx = game.current_credits_list_index;
int endidx = std::min(startidx + 9, (int)game.githubfriends.size());
int endidx = std::min(startidx + 9, (int)SDL_arraysize(Credits::githubfriends));
int maxheight = 14 * 9;
int totalheight = (endidx - startidx) * 14;
@ -323,7 +324,7 @@ void menurender()
for (int i = startidx; i < endidx; ++i)
{
graphics.Print(xofs, yofs, game.githubfriends[i], tr, tg, tb);
graphics.Print(xofs, yofs, Credits::githubfriends[i], tr, tg, tb);
xofs += 4;
yofs += 14;
}
@ -1305,11 +1306,11 @@ void gamecompleterender()
int creditOffset = 930;
for (size_t i = 0; i < game.superpatrons.size(); i += 1)
for (size_t i = 0; i < SDL_arraysize(Credits::superpatrons); i += 1)
{
if (graphics.onscreen(creditOffset + position))
{
graphics.Print(-1, creditOffset + position, game.superpatrons[i], tr, tg, tb, true);
graphics.Print(-1, creditOffset + position, Credits::superpatrons[i], tr, tg, tb, true);
}
creditOffset += 10;
}
@ -1318,11 +1319,11 @@ void gamecompleterender()
if (graphics.onscreen(creditOffset + position)) graphics.Print( -1, creditOffset + position, "and", tr, tg, tb, true);
creditOffset += 20;
for (size_t i = 0; i < game.patrons.size(); i += 1)
for (size_t i = 0; i < SDL_arraysize(Credits::patrons); i += 1)
{
if (graphics.onscreen(creditOffset + position))
{
graphics.Print(-1, creditOffset + position, game.patrons[i], tr, tg, tb, true);
graphics.Print(-1, creditOffset + position, Credits::patrons[i], tr, tg, tb, true);
}
creditOffset += 10;
}
@ -1331,11 +1332,11 @@ void gamecompleterender()
if (graphics.onscreen(creditOffset + position)) graphics.bigprint(40, creditOffset + position, "GitHub Contributors", tr, tg, tb, true);
creditOffset += 30;
for (size_t i = 0; i < game.githubfriends.size(); i += 1)
for (size_t i = 0; i < SDL_arraysize(Credits::githubfriends); i += 1)
{
if (graphics.onscreen(creditOffset + position))
{
graphics.Print(-1, creditOffset + position, game.githubfriends[i], tr, tg, tb, true);
graphics.Print(-1, creditOffset + position, Credits::githubfriends[i], tr, tg, tb, true);
}
creditOffset += 10;
}