<commit_before>#include "mugen/game.h"

#include "util/bitmap.h"
#include "util/font.h"
#include "util/token.h"
#include "configuration.h"
#include "menu/menu.h"
#include "menu/menu_global.h"
#include "globals.h"
#include "init.h"
#include "input/keyboard.h"
#include "input/input-manager.h"
#include "input/input-map.h"
#include "util/funcs.h"
#include "factory/font_render.h"
#include "shutdown_exception.h"
#include "loading.h"

#include "character.h"
#include "util.h"
#include "font.h"
#include "menu.h"
#include "stage.h"
#include "character-select.h"
#include "storyboard.h"
#include "behavior.h"

#include "config.h"

namespace PaintownUtil = ::Util;

using namespace Mugen;

const int DEFAULT_WIDTH = 320;
const int DEFAULT_HEIGHT = 240;

Game::Game(const PlayerType & playerType, const GameType & gameType, const std::string & systemFile):
playerType(playerType),
gameType(gameType),
systemFile(systemFile),
motifDirectory(Util::getFileDir(systemFile)){
}

Game::~Game(){
}

void Game::run(){
    Bitmap screen(GFX_X, GFX_Y);
    
    try{
        switch (gameType){
            default:
            case Arcade:
                doArcade(screen);
                break;
            case Versus:
                doVersus(screen);
                break;
            case TeamArcade:
                //select.run("Team Arcade" , 1, true, &screen);
                break;
            case TeamVersus:
                //gameInfo = select.run("Team Versus" , 2, true, &screen);
                break;
            case TeamCoop:
                //gameInfo = select.run("Team Cooperative" , 1, true, &screen);
                break;
            case Survival:
                //gameInfo = select.run("Survival" , 1, true, &screen);
                break;
            case SurvivalCoop:
                //gameInfo = select.run("Survival Cooperative" , 1, true, &screen);
                break;
            case Training:
                doTraining(screen);
                break;
            case Watch:
                doWatch(screen);
                break;
        }
    } catch (const MugenException e){
        screen.BlitFromScreen(0, 0);
        Bitmap error(screen.getWidth() - 100, screen.getHeight() - 100);
        error.fill(Bitmap::darken(Bitmap::makeColor(255, 0, 0), 3));

        Bitmap::transBlender(0, 0, 0, 196);
        error.drawTrans(50, 50, screen);
        screen.BlitToScreen();
        InputMap<int> wait;
        wait.set(Keyboard::Key_ENTER, 0, false, 1);
        InputManager::waitForPress(wait, 1);
        InputManager::waitForRelease(wait, 1);
    }
}

/* kind of dumb to just copy/paste the above. find a better solution */
static InputMap<Mugen::Keys> getPlayer1InputLeft(){
    InputMap<Mugen::Keys> input;
    input.set(Keyboard::Key_UP, 0, false, Mugen::Up);
    input.set(Keyboard::Key_DOWN, 0, false, Mugen::Down);
    input.set(Keyboard::Key_LEFT, 0, false, Mugen::Right);
    input.set(Keyboard::Key_RIGHT, 0, false, Mugen::Left);

    input.set(Keyboard::Key_A, 0, true, Mugen::A);
    input.set(Keyboard::Key_S, 0, true, Mugen::B);
    input.set(Keyboard::Key_D, 0, true, Mugen::C);
    input.set(Keyboard::Key_Z, 0, true, Mugen::X);<commit_msg>print error text<commit_after>#include "mugen/game.h"

#include "util/bitmap.h"
#include "util/font.h"
#include "util/token.h"
#include "configuration.h"
#include "menu/menu.h"
#include "menu/menu_global.h"
#include "globals.h"
#include "init.h"
#include "input/keyboard.h"
#include "input/input-manager.h"
#include "input/input-map.h"
#include "util/funcs.h"
#include "factory/font_render.h"
#include "shutdown_exception.h"
#include "loading.h"

#include "character.h"
#include "util.h"
#include "font.h"
#include "menu.h"
#include "stage.h"
#include "character-select.h"
#include "storyboard.h"
#include "behavior.h"

#include "config.h"

namespace PaintownUtil = ::Util;

using namespace Mugen;

const int DEFAULT_WIDTH = 320;
const int DEFAULT_HEIGHT = 240;

Game::Game(const PlayerType & playerType, const GameType & gameType, const std::string & systemFile):
playerType(playerType),
gameType(gameType),
systemFile(systemFile),
motifDirectory(Util::getFileDir(systemFile)){
}

Game::~Game(){
}

void Game::run(){
    Bitmap screen(GFX_X, GFX_Y);
    
    try{
        switch (gameType){
            default:
            case Arcade:
                doArcade(screen);
                break;
            case Versus:
                doVersus(screen);
                break;
            case TeamArcade:
                //select.run("Team Arcade" , 1, true, &screen);
                break;
            case TeamVersus:
                //gameInfo = select.run("Team Versus" , 2, true, &screen);
                break;
            case TeamCoop:
                //gameInfo = select.run("Team Cooperative" , 1, true, &screen);
                break;
            case Survival:
                //gameInfo = select.run("Survival" , 1, true, &screen);
                break;
            case SurvivalCoop:
                //gameInfo = select.run("Survival Cooperative" , 1, true, &screen);
                break;
            case Training:
                doTraining(screen);
                break;
            case Watch:
                doWatch(screen);
                break;
        }
    } catch (const MugenException e){
        screen.BlitFromScreen(0, 0);
        Bitmap error(screen.getWidth() - 100, screen.getHeight() - 100);
        error.fill(Bitmap::darken(Bitmap::makeColor(255, 0, 0), 3));
        static const char * DEFAULT_FONT = "/fonts/arial.ttf";
        const Font & font = Font::getFont(Filesystem::find(DEFAULT_FONT), 20, 20 );
        int y = 10;
        font.printf(10, y, Bitmap::makeColor(255, 255, 255), error, "Press ENTER to continue", 0);
        y += font.getHeight() * 2 + 1;
        font.printf(10, y, Bitmap::makeColor(255, 255, 255), error, "We are very sorry but an error has occured while trying", 0);
        y += font.getHeight() + 1;
        font.printf(10, y, Bitmap::makeColor(255, 255, 255), error, "to load MUGEN.", 0);

        Bitmap::transBlender(0, 0, 0, 200);
        error.drawTrans(50, 50, screen);
        screen.BlitToScreen();
        InputMap<int> wait;
        wait.set(Keyboard::Key_ENTER, 0, false, 1);
        InputManager::waitForPress(wait, 1);
        InputManager::waitForRelease(wait, 1);
    }
}

/* kind of dumb to just copy/paste the above. find a better solution */
static InputMap<Mugen::Keys> getPlayer1InputLeft(){
    InputMap<Mugen::Keys> input;
    input.set(Keyboard::Key_UP, 0, false, Mugen::Up);
    input.set(Keyboard::Key_DOWN, 0, false, Mugen::Down);
    input.set(Keyboard::Key_LEFT, 0, false, Mugen::Right);
    input.set(Keyboard::Key_RIGHT, 0, false, Mugen::Left);

    input.set(Keyboard::Key_A, 0, true, Mugen::A);
    input.set(Keyboard::Key_S, 0, true, Mugen::B);
    input.set(Keyboard::Key_D, 0, true, Mugen::C);
    input.set(Keyboard::Key_Z, 0, true, Mugen::X);
{'fraction_non_alphanumeric': 0.1446269086718525, 'fraction_numerical': 0.02031114952463267, 'mean_word_length': 2.5659989727786336, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5729844', 'n_tokens_mistral': 2426, 'n_tokens_neox': 2223, 'n_words': 517}