From 048928c68a9a8b10a75ae95fa5321fa63dde2c62 Mon Sep 17 00:00:00 2001 From: theoddone33 Date: Tue, 28 May 2002 04:07:28 +0000 Subject: [PATCH] New graphics stubbing arrangement --- Makefile | 20 ++++++++------- src/freespace2/freespace.cpp | 4 +++ src/graphics/gropengl.cpp | 23 +++-------------- src/graphics/grsoft.cpp | 48 +++++++++++++++++++++++++++++++++--- 4 files changed, 63 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index 9722d3e..dedb45d 100644 --- a/Makefile +++ b/Makefile @@ -2,16 +2,15 @@ # for that freespace 2 thing CC=g++-3.0 -CODE_BINARY=code.so +AR=ar +CODE_BINARY=code.a FS_BINARY=freespace2 LDFLAGS=$(shell sdl-config --libs) -CFLAGS=-Wall -g -DPLAT_UNIX -O2 $(shell sdl-config --cflags) -Iinclude/ - +CFLAGS=-Wall -g -DPLAT_UNIX -O2 $(shell sdl-config --cflags) -Iinclude/ -fwritable-strings %.o: %.cpp $(CC) -c -o $@ $< $(CFLAGS) - - + CODE_SOURCES =./src/anim/animplay.cpp \ ./src/anim/packunpack.cpp \ ./src/asteroid/asteroid.cpp \ @@ -46,6 +45,7 @@ CODE_SOURCES =./src/anim/animplay.cpp \ ./src/graphics/font.cpp \ ./src/graphics/gradient.cpp \ ./src/graphics/gropengl.cpp \ + ./src/graphics/grsoft.cpp \ ./src/graphics/grzbuffer.cpp \ ./src/graphics/line.cpp \ ./src/graphics/pixel.cpp \ @@ -253,12 +253,14 @@ CODE_OBJECTS=$(CODE_SOURCES:.cpp=.o) FS_OBJECTS=$(FS_SOURCES:.cpp=.o) -all: fs2 +all: $(FS_BINARY) -code.so: $(CODE_OBJECTS) - $(CC) -shared -o $(CODE_BINARY) $(LDFLAGS) $(CODE_OBJECTS) +$(CODE_BINARY): $(CODE_OBJECTS) + rm -rf $(CODE_BINARY) + $(AR) rc $(CODE_BINARY) $(CODE_OBJECTS) +# $(RANLIB) $(CODE_BINARY) -fs2: code.so $(FS_OBJECTS) +$(FS_BINARY): $(CODE_BINARY) $(FS_OBJECTS) $(CC) -o $(FS_BINARY) $(LDFLAGS) $(FS_OBJECTS) $(CODE_BINARY) clean: diff --git a/src/freespace2/freespace.cpp b/src/freespace2/freespace.cpp index 639ea4c..2809a57 100644 --- a/src/freespace2/freespace.cpp +++ b/src/freespace2/freespace.cpp @@ -7,6 +7,9 @@ * Freespace main body * * $Log$ + * Revision 1.5 2002/05/28 04:07:28 theoddone33 + * New graphics stubbing arrangement + * * Revision 1.4 2002/05/27 22:46:52 theoddone33 * Remove more undefined symbols * @@ -2039,6 +2042,7 @@ void game_init() GetCurrentDirectory(1024, whee); #else strcpy(whee, "."); + strcpy(whee,".\\."); STUB_FUNCTION; #endif strcat(whee, "\\"); diff --git a/src/graphics/gropengl.cpp b/src/graphics/gropengl.cpp index f89f877..ec9bc28 100644 --- a/src/graphics/gropengl.cpp +++ b/src/graphics/gropengl.cpp @@ -7,6 +7,9 @@ * Code that uses the OpenGL graphics library * * $Log$ + * Revision 1.5 2002/05/28 04:07:28 theoddone33 + * New graphics stubbing arrangement + * * Revision 1.4 2002/05/27 23:39:34 relnev * 0 * @@ -155,26 +158,6 @@ void gr_directdraw_init() STUB_FUNCTION; } -void gr_soft_activate(int active) // grsoft.cpp -{ - STUB_FUNCTION; -} - -void gr_soft_cleanup() // grsoft.cpp -{ - STUB_FUNCTION; -} - -void gr_soft_force_windowed() // grsoft.cpp -{ - STUB_FUNCTION; -} - -void gr_soft_init() -{ - STUB_FUNCTION; -} - void gr_opengl_preload_init() { STUB_FUNCTION; diff --git a/src/graphics/grsoft.cpp b/src/graphics/grsoft.cpp index 5a6b8b5..6efdcad 100644 --- a/src/graphics/grsoft.cpp +++ b/src/graphics/grsoft.cpp @@ -7,8 +7,11 @@ * Code for our software renderer using standard Win32 functions. (Dibsections, etc) * * $Log$ - * Revision 1.1 2002/05/03 03:28:09 root - * Initial revision + * Revision 1.2 2002/05/28 04:07:28 theoddone33 + * New graphics stubbing arrangement + * + * Revision 1.1.1.1 2002/05/03 03:28:09 root + * Initial import. * * * 12 7/14/99 9:42a Dave @@ -346,8 +349,10 @@ */ #include +#ifndef PLAT_UNIX #include #include +#endif #include "osapi.h" #include "2d.h" @@ -381,6 +386,7 @@ // requires you to malloc out space for the palette, which just isn't // worth the trouble. +#ifndef PLAT_UNIX typedef struct { WORD palVersion; WORD palNumEntries; @@ -407,6 +413,7 @@ HDC hDibDC = NULL; void *lpDibBits=NULL; HPALETTE hOldPalette=NULL, hPalette = NULL; +#endif int Gr_soft_inited = 0; @@ -414,6 +421,7 @@ static volatile int Grsoft_activated = 0; // If set, that means application g void gr_buffer_release() { +#ifndef PLAT_UNIX if ( hPalette ) { if (hDibDC) SelectPalette( hDibDC, hOldPalette, FALSE ); @@ -433,6 +441,7 @@ void gr_buffer_release() DeleteObject(hDibSection); hDibSection = NULL; } +#endif } @@ -447,6 +456,7 @@ void gr_buffer_create( int w, int h, int bpp ) gr_buffer_release(); +#ifndef PLAT_UNIX memset( &DibInfo, 0, sizeof(EZ_BITMAPINFO)); DibInfo.Header.biSize = sizeof(BITMAPINFOHEADER); DibInfo.Header.biWidth = w; @@ -563,6 +573,7 @@ void gr_buffer_create( int w, int h, int bpp ) if ( hDibSection == NULL ) { Int3(); // couldn't allocate dib section } +#endif } @@ -572,6 +583,7 @@ void gr_buffer_create( int w, int h, int bpp ) // All colors get changed in target_palette. +#ifndef PLAT_UNIX HPALETTE gr_create_palette_0(ubyte * target_palette) { EZ_LOGPALETTE LogicalPalette; @@ -783,9 +795,13 @@ HPALETTE gr_create_palette_254( ubyte * target_palette ) return CreatePalette( (LOGPALETTE *)&LogicalPalette ); } +#endif // !PLAT_UNIX void grx_set_palette_internal( ubyte * new_pal ) { +#ifdef PLAT_UNIX + STUB_FUNCTION; +#else if ( hPalette ) { if (hDibDC) SelectPalette( hDibDC, hOldPalette, FALSE ); @@ -869,12 +885,16 @@ void grx_set_palette_internal( ubyte * new_pal ) } else { hPalette = NULL; } +#endif } void grx_set_palette( ubyte * new_pal, int is_alphacolor ) { +#ifdef PLAT_UNIX + STUB_FUNCTION; +#else if ( hPalette ) { Mouse_hidden++; gr_reset_clip(); @@ -884,6 +904,7 @@ void grx_set_palette( ubyte * new_pal, int is_alphacolor ) } grx_set_palette_internal(new_pal); +#endif } @@ -1068,6 +1089,9 @@ void grx_flip() fix t1, t2, d, t; +#ifdef PLAT_UNIX + STUB_FUNCTION; +#else HWND hwnd = (HWND)os_get_window(); if ( hwnd ) { @@ -1107,6 +1131,7 @@ void grx_flip() } } +#endif if ( Grx_mouse_saved ) { grx_restore_mouse_area(); @@ -1118,6 +1143,9 @@ void grx_flip() // Set msg to 0 if calling outside of the window handler. void grx_flip_window(uint _hdc, int x, int y, int w, int h ) { +#ifdef PLAT_UNIX + STUB_FUNCTION; +#else HDC hdc = (HDC)_hdc; HPALETTE hOldPalette = NULL; int min_w, min_h; @@ -1140,6 +1168,7 @@ void grx_flip_window(uint _hdc, int x, int y, int w, int h ) if ( hOldPalette ){ SelectPalette(hdc,hOldPalette, FALSE ); } +#endif } @@ -1507,7 +1536,6 @@ void gr8_set_gamma(float gamma) void gr_soft_init() { // int i; - HWND hwnd = (HWND)os_get_window(); // software mode only supports 640x480 Assert(gr_screen.res == GR_640); @@ -1518,6 +1546,11 @@ void gr_soft_init() } // Prepare the window to go full screen +#ifdef PLAT_UNIX + STUB_FUNCTION; +#else + HWND hwnd = (HWND)os_get_window(); + if ( hwnd ) { DWORD style, exstyle; RECT client_rect; @@ -1550,6 +1583,7 @@ void gr_soft_init() SetActiveWindow(hwnd); SetForegroundWindow(hwnd); } +#endif Palette_flashed = 0; Palette_flashed_last_frame = 0; @@ -1559,6 +1593,9 @@ void gr_soft_init() gr_buffer_create( gr_screen.max_w, gr_screen.max_h, gr_screen.bits_per_pixel ); +#ifdef PLAT_UNIX + STUB_FUNCTION; +#else gr_screen.offscreen_buffer_base = lpDibBits; gr_screen.rowsize = DibInfo.Header.biWidth*((gr_screen.bits_per_pixel+7)/8); @@ -1572,6 +1609,7 @@ void gr_soft_init() // top up gr_screen.offscreen_buffer = gr_screen.offscreen_buffer_base; } +#endif grx_init_alphacolors(); @@ -1683,6 +1721,9 @@ void gr_soft_cleanup() void grx_change_palette( ubyte * new_pal ) { +#ifdef PLAT_UNIX + STUB_FUNCTION; +#else if ( hPalette ) { if (hDibDC) SelectPalette( hDibDC, hOldPalette, FALSE ); @@ -1705,6 +1746,7 @@ void grx_change_palette( ubyte * new_pal ) hOldPalette = SelectPalette( hDibDC, hPalette, FALSE ); SetDIBColorTable( hDibDC, 0, 256, DibInfo.Colors.aColors ); } +#endif } void grx_flash( int r, int g, int b ) -- 2.39.2