# HG changeset patch # User Matti Hamalainen # Date 1274989717 -10800 # Node ID 5d819ba6891c5abd68684ba3d79f72fb465dc482 # Parent 77f40a3c0095d8f3ac8674ec68145bcb93d8b9a3 More cleanups. diff -r 77f40a3c0095 -r 5d819ba6891c pwplib/attrconv.c --- a/pwplib/attrconv.c Thu May 27 20:16:08 2010 +0300 +++ b/pwplib/attrconv.c Thu May 27 22:48:37 2010 +0300 @@ -148,20 +148,20 @@ static void convcalc_monotab_attr(int parms) { - u8 attrmo[2][2]= /* &1: 0=ansicol_dump, 1=vt_dump */ + static const u8 attrmo[2][2]= /* &1: 0=ansicol_dump, 1=vt_dump */ { { 0x00,0x01 }, { 0x07,0x70 } }; - const char intens[16]= + static const char intens[16]= { 0,1,6,7, 3,4,9,10, 1,2,9,10,5,6,13,15 }; - int i=0; - for(;i<256;i++) + int i; + for(i = 0; i < 256; i++) pwpconv.col[i]= attrmo[parms&1][intens[i&15]>intens[(i>>4)&15]?0:1]; } diff -r 77f40a3c0095 -r 5d819ba6891c pwplib/convert.h --- a/pwplib/convert.h Thu May 27 20:16:08 2010 +0300 +++ b/pwplib/convert.h Thu May 27 22:48:37 2010 +0300 @@ -38,5 +38,6 @@ void conv_dump_rast(void); void convcalc_rast_col(void); void convcalc_rast_mono(void); +void conv_fromrast_full(u8*d,u8*s,int lgt); #endif /* PWP_CONVERT_H */ diff -r 77f40a3c0095 -r 5d819ba6891c pwplib/decterm.c --- a/pwplib/decterm.c Thu May 27 20:16:08 2010 +0300 +++ b/pwplib/decterm.c Thu May 27 22:48:37 2010 +0300 @@ -130,7 +130,7 @@ &16: charset: P vs B */ -int tty_vt_dump(char*s,char*p,int x,int y) +int tty_vt_dump(u8 *s,char*p,int x,int y) { TEMPMALL(u8,tmp,pwplib.videobuf.width*pwplib.videobuf.height*16), *d=tmp,skip=0,skipy=0; @@ -251,7 +251,7 @@ memcpy(d,"\33[0m",4*sizeof(char)); /* nuo framen alkuun */ pwp_tty.att=0;d+=4; - tty_write(tmp,d-tmp); + tty_write((char *)tmp, d - tmp); TEMPFREE(tmp); return d-tmp; } diff -r 77f40a3c0095 -r 5d819ba6891c pwplib/dumbterm.c --- a/pwplib/dumbterm.c Thu May 27 20:16:08 2010 +0300 +++ b/pwplib/dumbterm.c Thu May 27 22:48:37 2010 +0300 @@ -12,6 +12,7 @@ #include #include "pwplib.h" +#include "convert.h" #include "tty.h" struct diff -r 77f40a3c0095 -r 5d819ba6891c pwplib/pwplib-unix.c --- a/pwplib/pwplib-unix.c Thu May 27 20:16:08 2010 +0300 +++ b/pwplib/pwplib-unix.c Thu May 27 22:48:37 2010 +0300 @@ -1,20 +1,20 @@ #define __PWPLIB_C -#undef FISI_HACK /* NOTICE! Enabling this is a hack for Final ISI only */ - #include "config.h" #include #include +#include +#include +#include #ifdef DRIVE_SDL #include #endif -#include -#include -#include #include "pwplib.h" +#include "sound.h" +#include "video.h" #include "tty.h" @@ -23,7 +23,6 @@ static int sdl_init = 0; extern void pwplib_dummy(); -#define pwp_dummy pwplib_dummy void pwpwrite(const char *fmt, ...) { @@ -100,10 +99,10 @@ int pwplib_initcore() { int sdl_flags = 0; + pwplib_init_common(); /*** setup signals, etc ***/ - #ifdef DRIVE_SDL #ifdef DRIVE_VIDEO sdl_flags |= SDL_INIT_VIDEO; @@ -114,7 +113,6 @@ #ifdef FISI_HACK sdl_flags |= SDL_INIT_NOPARACHUTE; #endif - /* With SDL, we let it handle the signals */ if (SDL_Init(SDL_INIT_TIMER | SDL_INIT_EVENTTHREAD | sdl_flags) != 0) { pwpwrite("* SDL could not be initialized (%s).\n", SDL_GetError()); diff -r 77f40a3c0095 -r 5d819ba6891c pwplib/pwplib-win.c --- a/pwplib/pwplib-win.c Thu May 27 20:16:08 2010 +0300 +++ b/pwplib/pwplib-win.c Thu May 27 22:48:37 2010 +0300 @@ -13,6 +13,7 @@ #include "pwplib.h" #include "sound.h" +#include "video.h" static int sdl_init = 0; diff -r 77f40a3c0095 -r 5d819ba6891c pwplib/rastconv.c --- a/pwplib/rastconv.c Thu May 27 20:16:08 2010 +0300 +++ b/pwplib/rastconv.c Thu May 27 22:48:37 2010 +0300 @@ -185,27 +185,31 @@ /******** conv_fromrast ***********/ -void conv_fromrast_half(u8*d,u8*s,int hgt,int wdt) +void conv_fromrast_half(u8 *d, u8 *s, int hgt, int wdt) { - u16*dd=(u16*)d; - for(hgt>>=1;hgt;hgt--) + u16 *dd = (u16 *) d; + for(hgt >>= 1; hgt; hgt--) { int x=wdt; for(;x;x--) { - *dd++=pwpconv.rasthalve[BYTES2(s[0],s[wdt])]; + *dd++ = pwpconv.rasthalve[BYTES2(s[0],s[wdt])]; s++; } s+=wdt; } } -void conv_fromrast_full(u8*d,u8*s,int lgt) +void conv_fromrast_full(u8 *d, u8 *s, int lgt) { - u16*dd=(u16*)d;s++; - for(;lgt;lgt--) + u16 *dd = (u16 *) d; + s++; + for(; lgt; lgt--) { - *d++=pwpconv.rasthalve[BYTES2(s[0],s[0])]; + /* NOTICE! ATTENTION! This was originally *d++ .. does that even work? + * -- ccr + */ + *dd++ = pwpconv.rasthalve[BYTES2(s[0],s[0])]; s++; } } diff -r 77f40a3c0095 -r 5d819ba6891c pwplib/tty.c --- a/pwplib/tty.c Thu May 27 20:16:08 2010 +0300 +++ b/pwplib/tty.c Thu May 27 22:48:37 2010 +0300 @@ -51,7 +51,7 @@ pwp_tty.width=80; } -void tty_write(u8*data,int lgt) +void tty_write(char *data, int lgt) { if(lgt<0)lgt=strlen(data); diff -r 77f40a3c0095 -r 5d819ba6891c pwplib/tty.h --- a/pwplib/tty.h Thu May 27 20:16:08 2010 +0300 +++ b/pwplib/tty.h Thu May 27 22:48:37 2010 +0300 @@ -45,9 +45,10 @@ }; int tty_init(void); -void tty_write(u8 *data, int lgt); +void tty_write(char *data, int lgt); #ifdef DRIVE_TTY_DEC +void tty_vt1xx_init(); void tty_vt_dump_attr(); void tty_vt_initstring(); #endif diff -r 77f40a3c0095 -r 5d819ba6891c pwplib/video.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pwplib/video.h Thu May 27 22:48:37 2010 +0300 @@ -0,0 +1,15 @@ +#ifndef PWP_VIDEO_H +#define PWP_VIDEO_H 1 + +#include "config.h" +#include "pwplib.h" + +#ifdef DRIVE_SDL +int pwp_SDL_init(void); +#endif + +#ifdef DRIVE_WIN32 +int win32con_init(void); +#endif + +#endif /* PWP_VIDEO_H */ diff -r 77f40a3c0095 -r 5d819ba6891c pwplib/win32con.c --- a/pwplib/win32con.c Thu May 27 20:16:08 2010 +0300 +++ b/pwplib/win32con.c Thu May 27 22:48:37 2010 +0300 @@ -3,7 +3,7 @@ #ifdef DRIVE_WIN32 #include "pwplib.h" - +#include #include /******************** vcsa code ********************/ @@ -13,16 +13,16 @@ COORD size; CHAR_INFO*buf; -}pwp_win32; +} pwp_win32; /********************************************************/ -void pwpwrite(char*z) +void pwpwrite(char *fmt, ...) { /* fprintf(stderr,"%s\n",z); */ } -void win32con_dump_attr() +static void win32con_dump_attr(void) { u8*s=pwplib_buf; CHAR_INFO*d=pwp_win32.buf; @@ -45,13 +45,13 @@ } } -int win32con_probe() +static int win32con_probe(void) { if(GetStdHandle(STD_OUTPUT_HANDLE) != INVALID_HANDLE_VALUE) return 1; else return 0; } -int win32con_init() +int win32con_init(void) { AllocConsole();