misc/wrapper.c
author Wuzzy <Wuzzy2@mail.ru>
Sat, 27 Oct 2018 15:55:19 +0200
changeset 14014 f09276eb0c27
parent 4930 5d59bb58c365
permissions -rw-r--r--
Add 7 new taunts New sounds: * Bugger, Drat: Hog damages self only * Thisoneismine: Crate drop * Whatthe: Something is going to blow up close to hog * Solong, Ohdear: Death * Gonnagetyou: Vow for revenge Fallback code is added for existing voicepacks Thisoneismine is not used in Robot because the text in this sound file is "Threat detected.", which does not make sense.

/*
 This is an experimental main to use with hwLibary
 - create the library with `cmake . -DBUILD_ENGINE_LIBRARY=1' and `make hwengine'
 - compile this file with `gcc libhwLibrary.dylib libSDLmain.a wrapper.c -o wrapper -framework Cocoa -framework SDL'
   (in Mac OS X, but this command line shouldn't be much different in other OSes; make sure to set the correct files/paths)
 - this executable expect a save file "Save.hws" and the data folder "Data" to be in the same launching directory
 */

#include <stdlib.h>

extern void Game (const char **);

int SDL_main (int argc, const char **argv)
{
    // Note: if you get a segfault or other unexpected crashes on startup
    // make sure that these arguments are up-to-date with the ones actual needed

    const char **gameArgs = (const char**) malloc(sizeof(char *) * 11);

    gameArgs[ 0] = "0";          //ipcPort
    gameArgs[ 1] = "1024";       //cScreenWidth
    gameArgs[ 2] = "768";        //cScreenHeight
    gameArgs[ 3] = "0";          //cReducedQuality
    gameArgs[ 4] = "en.txt";     //cLocaleFName
    gameArgs[ 5] = "wrapper";    //UserNick
    gameArgs[ 6] = "1";          //isSoundEnabled
    gameArgs[ 7] = "1";          //isMusicEnabled
    gameArgs[ 8] = "1";          //cAltDamage
    gameArgs[ 9] = "0.0";        //rotationQt
    gameArgs[10] = "Save.hws";   //recordFileName

    Game(gameArgs);
    free(gameArgs);

    return 0;
}