src/video/dedicated_v.cpp
changeset 7374 54c06f06ecc8
parent 7111 269c76b5b987
child 7425 350b9265b7a2
equal deleted inserted replaced
7373:938b0afa92ed 7374:54c06f06ecc8
    11 #include "../network/network.h"
    11 #include "../network/network.h"
    12 #include "../window.h"
    12 #include "../window.h"
    13 #include "../console.h"
    13 #include "../console.h"
    14 #include "../variables.h"
    14 #include "../variables.h"
    15 #include "../genworld.h"
    15 #include "../genworld.h"
       
    16 #include "../blitter/blitter.hpp"
    16 #include "dedicated_v.h"
    17 #include "dedicated_v.h"
    17 
    18 
    18 #ifdef BEOS_NET_SERVER
    19 #ifdef BEOS_NET_SERVER
    19 #include <net/socket.h>
    20 #include <net/socket.h>
    20 #endif
    21 #endif
   110 }
   111 }
   111 
   112 
   112 #endif
   113 #endif
   113 
   114 
   114 
   115 
   115 static Pixel *_dedicated_video_mem;
   116 static void *_dedicated_video_mem;
   116 
   117 
   117 extern bool SafeSaveOrLoad(const char *filename, int mode, int newgm);
   118 extern bool SafeSaveOrLoad(const char *filename, int mode, int newgm);
   118 extern void SwitchMode(int new_mode);
   119 extern void SwitchMode(int new_mode);
   119 
   120 
   120 
   121 
   121 static const char *DedicatedVideoStart(const char * const *parm)
   122 static const char *DedicatedVideoStart(const char * const *parm)
   122 {
   123 {
       
   124 	int bpp = BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth();
       
   125 	if (bpp == 0) _dedicated_video_mem = NULL;
       
   126 	else          _dedicated_video_mem = malloc(_cur_resolution[0] * _cur_resolution[1] * (bpp / 8));
       
   127 
   123 	_screen.width = _screen.pitch = _cur_resolution[0];
   128 	_screen.width = _screen.pitch = _cur_resolution[0];
   124 	_screen.height = _cur_resolution[1];
   129 	_screen.height = _cur_resolution[1];
   125 	_dedicated_video_mem = (Pixel *)malloc(_cur_resolution[0] * _cur_resolution[1] * sizeof(Pixel));
   130 	_screen.renderer = RendererFactoryBase::SelectRenderer(BlitterFactoryBase::GetCurrentBlitter()->GetRenderer());
       
   131 	if (_screen.renderer == NULL) error("Couldn't load the renderer '%s' the selected blitter depends on", BlitterFactoryBase::GetCurrentBlitter()->GetRenderer());
   126 
   132 
   127 	SetDebugString("net=6");
   133 	SetDebugString("net=6");
   128 
   134 
   129 #ifdef WIN32
   135 #ifdef WIN32
   130 	// For win32 we need to allocate a console (debug mode does the same)
   136 	// For win32 we need to allocate a console (debug mode does the same)