Skip to content

Commit

Permalink
updated gitignore, modified main menu
Browse files Browse the repository at this point in the history
  • Loading branch information
ps committed Jan 19, 2018
1 parent ed24647 commit e0fdb91
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ local.properties
# PDT-specific
.buildpath

#################
## Clion
#################
cmake-build-release/
cmake-build-debug/

#################
## Visual Studio
#################
Expand Down
3 changes: 3 additions & 0 deletions code/ui/globalShuffledTiers.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ extern std::string SHUFFLED_TIER_1;
extern std::string SHUFFLED_TIER_2;
extern std::string SHUFFLED_TIER_3;

// the modified main menu
extern std::string MAIN_MENU;

// template for the generated menu files
// will be set on startup
static std::string TMPLT;
Expand Down
8 changes: 7 additions & 1 deletion code/ui/ui_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ USER INTERFACE MAIN
std::string SHUFFLED_TIER_1;
std::string SHUFFLED_TIER_2;
std::string SHUFFLED_TIER_3;
std::string MAIN_MENU;

#include "../server/exe_headers.h"

Expand Down Expand Up @@ -2898,6 +2899,11 @@ void UI_ParseMenu(const char *menuFile)
// if we injected our own randomized menu or not
bool injected = false;

// to display message on main menu
if(strcmp(menuFile, "ui/main.menu") == 0) {
injected = true;
}

// Mission select menu gets loaded --> ITS A TRAP!!!
// disable free() because YOLO
if(strcmp(menuFile, "ui/ingameMissionSelect1.menu") == 0 && SHUFFLED_TIER_1.length() > 0) {
Expand Down Expand Up @@ -4282,7 +4288,7 @@ void UI_MainMenu(void)
std::ifstream templateFileHandle(TEMPLATE_FILE_NAME.c_str());

// crash if the file isn't present
assert(templateFileHandle.good() && "Template file isn't present :(");
assert(templateFileHandle.good() && "The template file isn't present :(");


// read the tempalte from file
Expand Down
32 changes: 32 additions & 0 deletions code/ui/ui_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5867,6 +5867,38 @@ int PC_StartParseSession(const char *fileName,char **buffer)
// Try to open file and read it in.
len = ui.FS_ReadFile( fileName,(void **) buffer );

// display randomizer message on main menu
if(strcmp(fileName, "ui/main.menu") == 0) {
MAIN_MENU = std::string(*buffer);

size_t start_pos = 0;
std::string pattern = "@MENUS_EXIT";

std::vector<std::string> texts = {
"FWAHAHAHAHA",
"\"NOW WITH EVEN MOAR RANDOM\"",
"\"THIS_WILL_BE_HARD\"",
"\"OpenJK Rand0mizer by JoeBananas\"",
"\"GET ME OUTTA HERE\"",
"\"EXTREMELY HARD RANDOM PATTERN DETECTED\"",
"\"IT'S A TRAP\"",
"\"BLAME IT ON THE GRAN\"",
"\"THIS IS BANANAS\"",
"\"SUCH RANDOM\"",
};

srand(unsigned(time(NULL)));
std::string repl = texts[rand() % (texts.size()-1)];

while((start_pos = MAIN_MENU.find(pattern, start_pos)) != std::string::npos) {
MAIN_MENU.replace(start_pos, pattern.length(), repl);
start_pos += repl.length();
}


*buffer = &MAIN_MENU[0];
}

// Randomizer Hack: use our menu lel
if(strcmp(fileName, "ui/ingameMissionSelect1.menu") == 0 && SHUFFLED_TIER_1.length() > 0) {
// inject the randomized menu into the buffer --> Win
Expand Down

0 comments on commit e0fdb91

Please sign in to comment.