comparison krapula.c @ 31:c7703611ea04

Update to match with engine changes.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 04 Oct 2012 05:40:20 +0300
parents ca6f4ff8494f
children 94c099530548
comparison
equal deleted inserted replaced
30:f0e79fd6e720 31:c7703611ea04
1 #include "dmsimple.h" 1 #include "dmsimple.h"
2 #include "dmvecmat.h" 2 #include "dmvecmat.h"
3 #include <math.h> 3 #include <math.h>
4
5
6 DMOptArg optList[] =
7 {
8 { 0, '?', "help", "Show this help", OPT_NONE },
9 { 1, 'v', "verbose", "Be more verbose", OPT_NONE },
10 { 2, 'f', "fs", "Fullscreen", OPT_NONE },
11 #ifdef DM_DEBUG
12 { 3, 'd', "debug", "Debug mode", OPT_NONE },
13 #endif
14 };
15
16 const int optListN = sizeof(optList) / sizeof(optList[0]);
17
18
19
20 void argShowHelp()
21 {
22 dmPrintBanner(stdout, dmProgName, "[options]");
23 dmArgsPrintHelp(stdout, optList, optListN);
24 }
25
26
27 BOOL argHandleOpt(const int optN, char *optArg, char *currArg)
28 {
29 (void) optArg;
30
31 switch (optN)
32 {
33 case 0:
34 argShowHelp();
35 exit(0);
36 break;
37
38 case 1:
39 dmVerbosity++;
40 break;
41
42 case 2:
43 engine.optVFlags |= SDL_FULLSCREEN;
44 break;
45
46 #ifdef DM_DEBUG
47 case 3:
48 engine.optDebug = TRUE;
49 break;
50 #endif
51
52 default:
53 dmError("Unknown option '%s'.\n", currArg);
54 return FALSE;
55 }
56
57 return TRUE;
58 }
59 4
60 5
61 #define DM_COLORS (256) 6 #define DM_COLORS (256)
62 7
63 void dmMakePalette(SDL_Surface *scr) 8 void dmMakePalette(SDL_Surface *scr)
381 326
382 SDL_Surface *bmap; 327 SDL_Surface *bmap;
383 SDL_Surface *nosfe[NOSFE_MAX - NOSFE_MIN + 1]; 328 SDL_Surface *nosfe[NOSFE_MAX - NOSFE_MIN + 1];
384 329
385 330
386 int demoPreInit(int argc, char *argv[]) 331 int demoPreInit()
387 { 332 {
388 dmInitProg("krapula", "Lauantai Aamun Krapula", "0.2", "(c) 2012 Anciat Prodz & TNSP", "PENIS."); 333 dmInitProg("krapula",
334 "Lauantai Aamun Krapula",
335 "0.2", "(c) 2012 Anciat Prodz & TNSP", "PENIS.");
389 336
390 engine.optPackFilename = "orvellys.dat"; 337 engine.optPackFilename = "orvellys.dat";
391 engine.optDataPath = NULL; 338 engine.optDataPath = NULL;
392 engine.optResFlags = DRF_USE_PACK | DRF_PRELOAD_RES; 339 engine.optResFlags = DRF_USE_PACK | DRF_PRELOAD_RES;
393 340
396 engine.optBitDepth = 32; 343 engine.optBitDepth = 32;
397 engine.optVFlags = SDL_SWSURFACE | SDL_HWPALETTE; 344 engine.optVFlags = SDL_SWSURFACE | SDL_HWPALETTE;
398 #ifdef DM_DEBUG 345 #ifdef DM_DEBUG
399 engine.demoDuration = 150; 346 engine.demoDuration = 150;
400 #endif 347 #endif
401
402 if (!dmArgsProcess(argc, argv, optList, optListN,
403 argHandleOpt, NULL, FALSE))
404 return DMERR_INIT_FAIL;
405
406 dmPrint(0, "%s\n", dmProgDesc);
407 dmPrint(0, "TNSP simple demoengine initializing.\n");
408 dmPrint(0, "%s\n", dmProgAuthor);
409 #ifdef DM_USE_TREMOR
410 dmPrint(0, "Using libSDL, Tremor Vorbis codec, zlib and modified stb_image.\n"
411 #else
412 dmPrint(0, "Using libSDL, zlib and modified stb_image.\n"
413 #endif
414 "See README.txt for more information.\n");
415 348
416 return DMERR_OK; 349 return DMERR_OK;
417 } 350 }
418 351
419 352