(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.

This commit is contained in:
rubidium
2007-01-10 18:56:51 +00:00
parent ce75f6549d
commit a7d0cdf95f
190 changed files with 2825 additions and 2208 deletions

View File

@@ -5,6 +5,14 @@
#include "../hal.h"
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
extern const HalVideoDriver _cocoa_video_driver;
#ifdef __cplusplus
} // extern "C"
#endif //__cplusplus
#endif

View File

@@ -46,18 +46,11 @@ extern void HideMenuBar(void);
# endif
#endif
#include "../stdafx.h"
#include "../openttd.h"
#include "../debug.h"
#include "../functions.h"
#include "../gfx.h"
#include "../macros.h"
#include "../sdl.h"
#include "../window.h"
#include "../network/network.h"
#include "../variables.h"
#include "../os/macosx/splash.h"
#include "../stdafx.h"
#include "../debug.h"
#include "../macros.h"
#include "../os/macosx/splash.h"
#include "cocoa_v.h"
#include "cocoa_keys.h"
@@ -65,6 +58,7 @@ extern void HideMenuBar(void);
#undef Rect
/* Subclass of NSWindow to fix genie effect and support resize events */
@interface OTTD_QuartzWindow : NSWindow
- (void)miniaturize:(id)sender;
@@ -162,7 +156,7 @@ static struct CocoaVideoData {
NSQuickDrawView *qdview;
#define MAX_DIRTY_RECTS 100
OTTDRect dirty_rects[MAX_DIRTY_RECTS];
Rect dirty_rects[MAX_DIRTY_RECTS];
int num_dirty_rects;
uint16 palette16[256];

View File

@@ -277,7 +277,7 @@ static void DedicatedVideoMainLoop(void)
next_tick = cur_ticks + 30;
GameLoop();
_screen.dst_ptr = _dedicated_video_mem;
_screen.dst_ptr = (Pixel*)_dedicated_video_mem;
UpdateWindows();
}
CSleep(1);

View File

@@ -27,7 +27,7 @@ static void NullVideoMainLoop(void)
for (i = 0; i < 1000; i++) {
GameLoop();
_screen.dst_ptr = _null_video_mem;
_screen.dst_ptr = (Pixel*)_null_video_mem;
UpdateWindows();
}
}

View File

@@ -469,7 +469,7 @@ static void SdlVideoMainLoop(void)
(keys[SDLK_DOWN] ? 8 : 0);
GameLoop();
_screen.dst_ptr = _sdl_screen->pixels;
_screen.dst_ptr = (Pixel*)_sdl_screen->pixels;
UpdateWindows();
if (++pal_tick > 4) {
CheckPaletteAnim();
@@ -478,7 +478,7 @@ static void SdlVideoMainLoop(void)
DrawSurfaceToScreen();
} else {
SDL_CALL SDL_Delay(1);
_screen.dst_ptr = _sdl_screen->pixels;
_screen.dst_ptr = (Pixel*)_sdl_screen->pixels;
DrawTextMessage();
DrawMouseCursor();
DrawSurfaceToScreen();

View File

@@ -42,7 +42,7 @@ static void MakePalette(void)
LOGPALETTE *pal;
uint i;
pal = alloca(sizeof(LOGPALETTE) + (256-1) * sizeof(PALETTEENTRY));
pal = (LOGPALETTE*)alloca(sizeof(LOGPALETTE) + (256-1) * sizeof(PALETTEENTRY));
pal->palVersion = 0x300;
pal->palNumEntries = 256;
@@ -169,7 +169,7 @@ int RedrawScreenDebug(void)
dc = GetDC(_wnd.main_wnd);
dc2 = CreateCompatibleDC(dc);
old_bmp = SelectObject(dc2, _wnd.dib_sect);
old_bmp = (HBITMAP)SelectObject(dc2, _wnd.dib_sect);
old_palette = SelectPalette(dc, _wnd.gdi_palette, FALSE);
BitBlt(dc, 0, 0, _wnd.width, _wnd.height, dc2, 0, 0, SRCCOPY);
SelectPalette(dc, old_palette, TRUE);
@@ -222,7 +222,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
BeginPaint(hwnd, &ps);
dc = ps.hdc;
dc2 = CreateCompatibleDC(dc);
old_bmp = SelectObject(dc2, _wnd.dib_sect);
old_bmp = (HBITMAP)SelectObject(dc2, _wnd.dib_sect);
old_palette = SelectPalette(dc, _wnd.gdi_palette, FALSE);
if (_pal_last_dirty != -1) {
@@ -358,7 +358,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
GetKeyboardState(ks);
if (ToUnicode(wParam, 0, ks, &w, 1, 0) != 1) {
/* On win9x ToUnicode always fails, so fall back to ToAscii */
if (ToAscii(wParam, 0, ks, &w, 0) != 1) w = 0; // no translation was possible
if (ToAscii(wParam, 0, ks, (LPWORD)&w, 0) != 1) w = 0; // no translation was possible
}
pressed_key = w | MapWindowsKey(wParam) << 16;
@@ -496,7 +496,7 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
}
case WM_ACTIVATEAPP:
_wnd.has_focus = (bool)wParam;
_wnd.has_focus = (wParam != 0);
break;
}
return DefWindowProc(hwnd, msg, wParam, lParam);
@@ -622,13 +622,13 @@ static bool AllocateDibSection(int w, int h)
_wnd.alloced_bits = NULL;
}
bi = alloca(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
bi = (BITMAPINFO*)alloca(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
memset(bi, 0, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
if (_wnd.double_size) {
w = ALIGN(w, 4);
_wnd.alloced_bits = _wnd.buffer_bits = malloc(w * h);
_wnd.alloced_bits = _wnd.buffer_bits = (Pixel*)malloc(w * h);
w *= 2;
h *= 2;
}