changeset 14:2663b7bb23b9

Touchups.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 15 Mar 2013 17:57:09 +0200
parents 3a358d053ffc
children e5603b03732b
files 3x666.c config.h
diffstat 2 files changed, 38 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/3x666.c	Fri Mar 15 17:27:26 2013 +0200
+++ b/3x666.c	Fri Mar 15 17:57:09 2013 +0200
@@ -8,7 +8,6 @@
 #include "3xfont.h"
 
 
-/** typedefs **/
 #if !defined(FALSE) && !defined(TRUE) && !defined(BOOL)
 typedef enum { FALSE = 0, TRUE = 1 } BOOL;
 #endif
@@ -59,9 +58,29 @@
 }
 
 
+void dmPrintVA(const char *fmt, va_list ap)
+{
+#ifndef __WIN32
+    vfprintf(stderr, fmt, ap);
+#endif
+}
+
+
+void dmPrint(const char *fmt, ...)
+{
+#ifndef __WIN32
+    va_list ap;
+
+    va_start(ap, fmt);
+    dmPrintVA(fmt, ap);
+    va_end(ap);
+#endif
+}
+
+
 void dmErrorVA(const char *fmt, va_list ap)
 {
-    fprintf(stderr, "3x666: ");
+    fprintf(stderr, SET_PROG_NAME ": ");
     vfprintf(stderr, fmt, ap);
 }
 
@@ -418,7 +437,7 @@
     int o = 0, oo = 0;
     float a = 0, da = 386 / (float) drumlgt, dda = da / (float) drumlgt;
 
-    printf("aCtIvATiNg 303 eMuLAtOR\n");
+    dmPrint("aCtIvATiNg 303 eMuLAtOR\n");
 
     for (i = drumlgt; i; i--)
     {
@@ -842,7 +861,7 @@
 #define ENDSCR    0x0800
 #define DEMOEND   0x1000
 
-const short dezign[] = {
+const Uint16 dezign[] = {
     0   , BLACKBG | OCSALOGO | SCROLL0,
     256 , FLASHBG | BALLIE | BALLJUMPS | COUNTAH,
     384 , BLACKBG | BALLIE | BALLJUMPS | COUNTAH | OCSALOGO,
@@ -868,17 +887,21 @@
 int main(int argc, char *argv[])
 {
     BOOL initSDL = FALSE;
-    vec3d joo;
     const int U = SET_VID_BUFW / 40;
-    int flagz = 0;
-    const short *dez = dezign;
+    const Uint16  *dez = dezign;
+    int flagz = 0, flixtim = 0;
     char *phiword = NULL, *dizainword = NULL;
-    int flixtim = 0;
 
+    dmPrint(
+    SET_PROG_NAME " by Ocsa (PWP) (c) 1998\n"
+    "libSDL port by ccr/TNSP^PWP (c) 2013\n");
+    
+    // Parse commandline options
 //    engine.optVFlags |= SDL_FULLSCREEN;
 
 
     // Initialize SDL components
+    dmPrint("Engine initializing ..\n");
     if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER) != 0)
     {
         dmError("Could not initialize SDL: %s\n", SDL_GetError());
@@ -915,6 +938,7 @@
     setpal();
 
     // Start audio, enter main loop
+    dmPrint("We are go.\n");
     SDL_LockAudio();
     SDL_PauseAudio(0);
     SDL_UnlockAudio();
@@ -979,6 +1003,7 @@
             flagz = *dez++;
             if (flagz & FLASHTXT)
                 flixtim = *(dez - 2);
+
             if (flagz & TXTSCR)
                 dizainword = dotxtscr();
         }
@@ -1012,7 +1037,7 @@
             rotochess(engine.screen, sin(qt * 0.03) * zoom, cos(qt * 0.03) * zoom, 0, 0);
         }
 
-/*	if(flagz&PLASMABG) drawplasma(ruutu,t); */
+        //if(flagz&PLASMABG) drawplasma(ruutu, qt);
 
         if (flagz & OCSALOGO)
         {
@@ -1032,6 +1057,7 @@
         if (flagz & BALLIE)
         {
             int zoom;
+            vec3d joo;
             if (flagz & BALLJUMPS)
                 zoom = abs((qt % 96) - 48);
             else
@@ -1078,7 +1104,7 @@
             n /= 10;
         }
 
-        // Flip screen
+        // Flip screen, increase frame count, wait
         if (SDL_MUSTLOCK(engine.screen) != 0)
             SDL_UnlockSurface(engine.screen);
 
@@ -1089,6 +1115,7 @@
 
 error_exit:
     // Shutdown
+    dmPrint("Shutting down.\n");
     SDL_ShowCursor(SDL_ENABLE);
     if (engine.screen)
         SDL_FreeSurface(engine.screen);
--- a/config.h	Fri Mar 15 17:27:26 2013 +0200
+++ b/config.h	Fri Mar 15 17:57:09 2013 +0200
@@ -5,6 +5,7 @@
 #define SET_AUDIO_FREQ 44100
 
 
+#define SET_PROG_NAME  "3x666"
 #define SET_WIN_NAME   "Ocsa (PWP) - 3x666"