Changeset - r2189:2faee8988cf3
[Not reviewed]
master
0 30 0
tron - 19 years ago 2005-07-25 07:16:10
tron@openttd.org
(svn r2704) Remove . from include path again, too much trouble. Also add some #ifdefs and #includes for the Windows build
30 files changed with 108 insertions and 96 deletions:
0 comments (0 inline, 0 general)
Makefile
Show inline comments
 
@@ -316,49 +316,48 @@ ifeq ($(shell if test $(CC_VERSION) -ge 
 
  CFLAGS += -W -Wno-unused-parameter
 
endif
 
ifeq ($(shell if test $(CC_VERSION) -ge 34; then echo true; fi), true)
 
  CFLAGS += -Wdeclaration-after-statement -Wold-style-definition
 
endif
 

	
 
ifdef DEBUG
 
  ifeq ($(shell expr $(DEBUG) \>= 1), 1)
 
    CFLAGS += -g -D_DEBUG
 
  endif
 
  ifeq ($(shell expr $(DEBUG) \>= 2), 1)
 
    CFLAGS += -fno-inline
 
  endif
 
  ifeq ($(shell expr $(DEBUG) \>= 3), 1)
 
    CFLAGS += -O0
 
  endif
 
endif
 

	
 
ifdef PROFILE
 
  CFLAGS += -pg
 
  LDFLAGS += -pg
 
endif
 

	
 
CDEFS=-DWITH_REV
 
CFLAGS += -I. -I-
 

	
 
ifndef DEBUG
 
ifndef PROFILE
 
# Release mode
 
ifndef MORPHOS
 
ifndef IRIX
 
# automatical strip breaks under morphos
 
BASECFLAGS += -s
 
LDFLAGS += -s
 
endif
 
endif
 
endif
 

	
 
ifdef OSX
 
# these compilerflags makes the app run as fast as possible without making the app unstable. It works on G3 or newer
 
BASECFLAGS += -O3 -funroll-loops -fsched-interblock -falign-loops=16 -falign-jumps=16 -falign-functions=16 -falign-jumps-max-skip=15 -falign-loops-max-skip=15 -mdynamic-no-pic -mpowerpc-gpopt -force_cpusubtype_ALL
 
else
 
ifdef MORPHOS
 
BASECFLAGS += -O2 -noixemul -fstrict-aliasing -fexpensive-optimizations
 
BASECFLAGS += -mcpu=604 -fno-inline -mstring -mmultiple
 
else
 
BASECFLAGS += -O2
 
endif
 
ifndef PROFILE
music/bemidi.h
Show inline comments
 
/* $Id$ */
 

	
 
#ifndef MUSIC_BEMIDI_H
 
#define MUSIC_BEMIDI_H
 

	
 
#include "hal.h"
 
#include "../hal.h"
 

	
 
extern const HalMusicDriver _bemidi_music_driver;
 

	
 
#endif
music/dmusic.c
Show inline comments
 
@@ -5,57 +5,57 @@
 
 * Copyright (c) 2002-2004 OpenTTD Developers. All Rights Reserved.  *
 
 *                                                                   *
 
 * Web site: http://openttd.sourceforge.net/                         *
 
 *********************************************************************/
 

	
 
/*
 
 * This program is free software; you can redistribute it and/or modify
 
 * it under the terms of the GNU General Public License as published by
 
 * the Free Software Foundation; either version 2 of the License, or
 
 * (at your option) any later version.
 
 *
 
 * This program is distributed in the hope that it will be useful,
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
 * GNU General Public License for more details.
 
 *
 
 * You should have received a copy of the GNU General Public License
 
 * along with this program; if not, write to the Free Software
 
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 */
 

	
 
/* DirectMusic driver for Win32 */
 
/* Based on dxmci from TTDPatch */
 

	
 
#include "stdafx.h"
 
#include "../stdafx.h"
 

	
 
#ifdef WIN32_ENABLE_DIRECTMUSIC_SUPPORT
 

	
 
#include "openttd.h"
 
#include "string.h"
 
#include "variables.h"
 
#include "sound.h"
 
#include "music/dmusic.h"
 
#include "../openttd.h"
 
#include "../string.h"
 
#include "../variables.h"
 
#include "../sound.h"
 
#include "dmusic.h"
 

	
 
static const char * DMusicMidiStart(const char * const *parm);
 
static void DMusicMidiStop(void);
 
static void DMusicMidiPlaySong(const char *filename);
 
static void DMusicMidiStopSong(void);
 
static bool DMusicMidiIsSongPlaying(void);
 
static void DMusicMidiSetVolume(byte vol);
 

	
 
const HalMusicDriver _dmusic_midi_driver = {
 
	DMusicMidiStart,
 
	DMusicMidiStop,
 
	DMusicMidiPlaySong,
 
	DMusicMidiStopSong,
 
	DMusicMidiIsSongPlaying,
 
	DMusicMidiSetVolume,
 
};
 

	
 
extern bool LoadMIDI (char *directory, char *filename);
 
extern bool InitDirectMusic (void);
 
extern void ReleaseSegment (void);
 
extern void ShutdownDirectMusic (void);
 
extern bool LoadMIDI (char *directory, char *filename);
 
extern void PlaySegment (void);
 
extern void StopSegment (void);
music/dmusic.h
Show inline comments
 
/* $Id$ */
 

	
 
#ifndef MUSIC_DMUSIC_H
 
#define MUSIC_DMUSIC_H
 

	
 
#include "hal.h"
 
#include "../hal.h"
 

	
 
extern const HalMusicDriver _dmusic_midi_driver;
 

	
 
#endif
music/extmidi.c
Show inline comments
 
/* $Id$ */
 

	
 
#ifndef __BEOS__
 
#ifndef __MORPHOS__
 
#include "stdafx.h"
 

	
 
#include "openttd.h"
 
#include "music/extmidi.h"
 
#include "sound.h"
 
#include "string.h"
 
#include "variables.h"
 
#include "../stdafx.h"
 
#include "../openttd.h"
 
#include "../sound.h"
 
#include "../string.h"
 
#include "../variables.h"
 
#include "extmidi.h"
 
#include <fcntl.h>
 
#include <sys/types.h>
 
#include <sys/wait.h>
 
#include <unistd.h>
 
#include <signal.h>
 
#include <sys/stat.h>
 
#include <errno.h>
 

	
 
static struct {
 
	char song[MAX_PATH];
 
	int pid;
 
} _midi;
 

	
 
static void DoPlay(void);
 
static void DoStop(void);
 

	
 
static const char* ExtMidiStart(const char* const * parm)
 
{
 
	_midi.song[0] = '\0';
 
	_midi.pid = -1;
 
	return NULL;
 
}
 

	
 
static void ExtMidiStop(void)
music/extmidi.h
Show inline comments
 
/* $Id$ */
 

	
 
#ifndef MUSIC_EXTERNAL_H
 
#define MUSIC_EXTERNAL_H
 

	
 
#include "hal.h"
 
#include "../hal.h"
 

	
 
extern const HalMusicDriver _extmidi_music_driver;
 

	
 
#endif
music/null_m.c
Show inline comments
 
/* $Id$ */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "music/null_m.h"
 
#include "../stdafx.h"
 
#include "../openttd.h"
 
#include "null_m.h"
 

	
 
static const char* NullMidiStart(const char* const* parm) { return NULL; }
 
static void NullMidiStop(void) {}
 
static void NullMidiPlaySong(const char *filename) {}
 
static void NullMidiStopSong(void) {}
 
static bool NullMidiIsSongPlaying(void) { return true; }
 
static void NullMidiSetVolume(byte vol) {}
 

	
 
const HalMusicDriver _null_music_driver = {
 
	NullMidiStart,
 
	NullMidiStop,
 
	NullMidiPlaySong,
 
	NullMidiStopSong,
 
	NullMidiIsSongPlaying,
 
	NullMidiSetVolume,
 
};
music/null_m.h
Show inline comments
 
/* $Id$ */
 

	
 
#ifndef MUSIC_NULL_H
 
#define MUSIC_NULL_H
 

	
 
#include "hal.h"
 
#include "../hal.h"
 

	
 
extern const HalMusicDriver _null_music_driver;
 

	
 
#endif
music/os2_m.c
Show inline comments
 
/* $Id$ */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "music/os2_m.h"
 
#include "../stdafx.h"
 
#include "../openttd.h"
 
#include "os2_m.h"
 

	
 
#define INCL_DOS
 
#define INCL_OS2MM
 
#define INCL_WIN
 

	
 
#include <stdarg.h>
 
#include <os2.h>
 
#include <os2me.h>
 

	
 
/**********************
 
 * OS/2 MIDI PLAYER
 
 **********************/
 

	
 
/* Interesting how similar the MCI API in OS/2 is to the Win32 MCI API,
 
 * eh? Anyone would think they both came from the same place originally! ;)
 
 */
 

	
 
static long CDECL MidiSendCommand(const char *cmd, ...)
 
{
 
	va_list va;
 
	char buf[512];
 
	va_start(va, cmd);
 
	vsprintf(buf, cmd, va);
 
	va_end(va);
music/os2_m.h
Show inline comments
 
/* $Id$ */
 

	
 
#ifndef MUSIC_OS2_H
 
#define MUSIC_OS2_H
 

	
 
#include "hal.h"
 
#include "../hal.h"
 

	
 
extern const HalMusicDriver _os2_music_driver;
 

	
 
#endif
music/win32_m.c
Show inline comments
 
/* $Id$ */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "music/win32_m.h"
 
#include "../stdafx.h"
 
#include "../openttd.h"
 
#include "win32_m.h"
 
#include <windows.h>
 
#include <mmsystem.h>
 

	
 
static struct {
 
	bool stop_song;
 
	bool terminate;
 
	bool playing;
 
	int new_vol;
 
	HANDLE wait_obj;
 
	char start_song[260];
 
} _midi;
 

	
 
static void Win32MidiPlaySong(const char *filename)
 
{
 
	strcpy(_midi.start_song, filename);
 
	_midi.playing = true;
 
	_midi.stop_song = false;
 
	SetEvent(_midi.wait_obj);
 
}
 

	
 
static void Win32MidiStopSong(void)
 
{
 
	if (_midi.playing) {
 
		_midi.stop_song = true;
 
		_midi.start_song[0] = '\0';
 
		SetEvent(_midi.wait_obj);
music/win32_m.h
Show inline comments
 
/* $Id$ */
 

	
 
#ifndef MUSIC_WIN32_H
 
#define MUSIC_WIN32_H
 

	
 
#include "hal.h"
 
#include "../hal.h"
 

	
 
extern const HalMusicDriver _win32_music_driver;
 

	
 
#endif
sdl.c
Show inline comments
 
/* $Id$ */
 

	
 
#include "stdafx.h"
 

	
 
#ifdef WITH_SDL
 

	
 
#include "openttd.h"
 
#include "sdl.h"
 
#include <SDL.h>
 

	
 
#ifdef UNIX
 
#include <signal.h>
 

	
 
#ifdef __MORPHOS__
 
	// The system supplied definition of SIG_DFL is wrong on MorphOS
 
	#undef SIG_DFL
 
	#define SIG_DFL (void (*)(int))0
 
#endif
 
#endif
 

	
 
static int _sdl_usage;
 

	
 
#ifdef DYNAMICALLY_LOADED_SDL
 

	
 
#include "win32.h"
 

	
 
#define M(x) x "\0"
 
static const char sdl_files[] =
 
	M("sdl.dll")
 
	M("SDL_Init")
 
@@ -106,24 +109,26 @@ const char* SdlOpen(uint32 x)
 
	}
 

	
 
#ifdef UNIX
 
	signal(SIGABRT, SdlAbort);
 
	signal(SIGSEGV, SdlAbort);
 
	signal(SIGFPE, SdlAbort);
 
#endif
 

	
 
	return NULL;
 
}
 

	
 
void SdlClose(uint32 x)
 
{
 
	if (x != 0)
 
		SDL_CALL SDL_QuitSubSystem(x);
 
	if (--_sdl_usage == 0) {
 
		SDL_CALL SDL_Quit();
 
		#ifdef UNIX
 
		signal(SIGABRT, SIG_DFL);
 
		signal(SIGSEGV, SIG_DFL);
 
		signal(SIGFPE, SIG_DFL);
 
		#endif
 
	}
 
}
 

	
 
#endif
sound/null_s.c
Show inline comments
 
/* $Id$ */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "sound/null_s.h"
 
#include "../stdafx.h"
 
#include "../openttd.h"
 
#include "null_s.h"
 

	
 
static const char *NullSoundStart(const char * const *parm) { return NULL; }
 
static void NullSoundStop(void) {}
 

	
 
const HalSoundDriver _null_sound_driver = {
 
	NullSoundStart,
 
	NullSoundStop,
 
};
sound/null_s.h
Show inline comments
 
/* $Id$ */
 

	
 
#ifndef SOUND_NULL_H
 
#define SOUND_NULL_H
 

	
 
#include "hal.h"
 
#include "../hal.h"
 

	
 
extern const HalSoundDriver _null_sound_driver;
 

	
 
#endif
sound/sdl_s.c
Show inline comments
 
/* $Id$ */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "driver.h"
 
#include "mixer.h"
 
#include "sdl.h"
 
#include "sound/sdl_s.h"
 
#include "../stdafx.h"
 

	
 
#ifdef WITH_SDL
 

	
 
#include "../openttd.h"
 
#include "../driver.h"
 
#include "../mixer.h"
 
#include "../sdl.h"
 
#include "sdl_s.h"
 
#include <SDL.h>
 

	
 
static void CDECL fill_sound_buffer(void *userdata, Uint8 *stream, int len)
 
{
 
	MxMixSamples(_mixer, stream, len / 4);
 
}
 

	
 
static const char *SdlSoundStart(const char * const *parm)
 
{
 
	SDL_AudioSpec spec;
 

	
 
	const char *s = SdlOpen(SDL_INIT_AUDIO);
 
	if (s != NULL) return s;
 

	
 
	spec.freq = GetDriverParamInt(parm, "hz", 11025);
 
	spec.format = AUDIO_S16SYS;
 
	spec.channels = 2;
 
	spec.samples = 512;
 
	spec.callback = fill_sound_buffer;
 
	SDL_CALL SDL_OpenAudio(&spec, &spec);
 
	SDL_CALL SDL_PauseAudio(0);
 
	return NULL;
 
}
 

	
 
static void SdlSoundStop(void)
 
{
 
	SDL_CALL SDL_CloseAudio();
 
	SdlClose(SDL_INIT_AUDIO);
 
}
 

	
 
const HalSoundDriver _sdl_sound_driver = {
 
	SdlSoundStart,
 
	SdlSoundStop,
 
};
 

	
 
#endif
sound/sdl_s.h
Show inline comments
 
/* $Id$ */
 

	
 
#ifndef SOUND_SDL_H
 
#define SOUND_SDL_H
 

	
 
#include "hal.h"
 
#include "../hal.h"
 

	
 
extern const HalSoundDriver _sdl_sound_driver;
 

	
 
#endif
sound/win32_s.c
Show inline comments
 
/* $Id$ */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "driver.h"
 
#include "functions.h"
 
#include "mixer.h"
 
#include "sound/win32_s.h"
 
#include "../stdafx.h"
 
#include "../openttd.h"
 
#include "../driver.h"
 
#include "../functions.h"
 
#include "../mixer.h"
 
#include "win32_s.h"
 
#include <windows.h>
 
#include <mmsystem.h>
 

	
 
static HWAVEOUT _waveout;
 
static WAVEHDR _wave_hdr[2];
 
static int _bufsize;
 

	
 
static void PrepareHeader(WAVEHDR *hdr)
 
{
 
	hdr->dwBufferLength = _bufsize * 4;
 
	hdr->dwFlags = 0;
 
	hdr->lpData = malloc(_bufsize * 4);
 
	if (hdr->lpData == NULL ||
 
			waveOutPrepareHeader(_waveout, hdr, sizeof(WAVEHDR)) != MMSYSERR_NOERROR)
 
		error("waveOutPrepareHeader failed");
 
}
 

	
 
static void FillHeaders(void)
 
{
 
	WAVEHDR *hdr;
 

	
 
	for (hdr = _wave_hdr; hdr != endof(_wave_hdr); hdr++) {
 
		if (!(hdr->dwFlags & WHDR_INQUEUE)) {
 
			MxMixSamples(_mixer, hdr->lpData, hdr->dwBufferLength / 4);
 
			if (waveOutWrite(_waveout, hdr, sizeof(WAVEHDR)) != MMSYSERR_NOERROR)
 
				error("waveOutWrite failed");
sound/win32_s.h
Show inline comments
 
/* $Id$ */
 

	
 
#ifndef SOUND_WIN32_H
 
#define SOUND_WIN32_H
 

	
 
#include "hal.h"
 
#include "../hal.h"
 

	
 
extern const HalSoundDriver _win32_sound_driver;
 

	
 
#endif
table/engines.h
Show inline comments
 
/* $Id$ */
 

	
 
#ifndef ENGINES_H
 
#define ENGINES_H
 

	
 
/** @file table/engines.h
 
  * This file contains all the data for vehicles
 
  */
 

	
 
#include "sound.h"
 
#include "../sound.h"
 

	
 
/** Writes the properties of a vehicle into the EngineInfo struct.
 
  * @see EngineInfo
 
  * @param a Introduction date
 
  * @param e Rail Type of the vehicle
 
  * @param f Bitmask of the climates
 
  */
 
#define MK(a,b,c,d,e,f) {a,b,c,d,((e)<<4)|(f)}
 
/** Writes the properties of a train carriage into the EngineInfo struct.
 
  * @see EngineInfo
 
  * @param a Introduction date
 
  * @param e Rail Type of the vehicle
 
  * @param f Bitmask of the climates
 
  * @note the 0x80 in parameter b sets the "is carriage bit"
 
  */
 
#define MW(a,b,c,d,e,f) {a,b|0x80,c,d,((e)<<4)|(f)}
 

	
 
EngineInfo _engine_info[TOTAL_NUM_ENGINES] = {
 
	MK(  1827,  20,  15,  30,   0,   1), /*   0 Kirby Paul Tank (Steam) */
 
	MK( 12784,  20,  22,  30,   0,   6), /*   1 MJS 250 (Diesel) */
 
	MK(  9497,  20,  20,  50,   0,   8), /*   2 Ploddyphut Choo-Choo */
 
	MK( 11688,  20,  20,  30,   0,   8), /*   3 Powernaut Choo-Choo */
 
	MK( 16802,  20,  20,  30,   0,   8), /*   4 Mightymover Choo-Choo */
 
	MK( 18993,  20,  20,  30,   0,   8), /*   5 Ploddyphut Diesel */
table/namegen.h
Show inline comments
 
/* $Id$ */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "../stdafx.h"
 
#include "../openttd.h"
 

	
 
static const char *name_original_english_1[] = {
 
	"Great ",
 
	"Little ",
 
	"New ",
 
	"Fort ",
 
};
 

	
 
static const char *name_original_english_2[] = {
 
	"Wr",
 
	"B",
 
	"C",
 
	"Ch",
 
	"Br",
 
	"D",
 
	"Dr",
 
	"F",
 
	"Fr",
 
	"Fl",
 
	"G",
 
	"Gr",
 
	"H",
 
	"L",
 
	"M",
video/dedicated_v.c
Show inline comments
 
/* $Id$ */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "debug.h"
 
#include "functions.h"
 
#include "network.h"
 
#include "video/dedicated_v.h"
 
#include "../stdafx.h"
 
#include "../openttd.h"
 
#include "dedicated_v.h"
 

	
 
#ifdef ENABLE_NETWORK
 

	
 
#include "gfx.h"
 
#include "window.h"
 
#include "command.h"
 
#include "console.h"
 
#include "variables.h"
 
#include "../debug.h"
 
#include "../functions.h"
 
#include "../gfx.h"
 
#include "../network.h"
 
#include "../window.h"
 
#include "../command.h"
 
#include "../console.h"
 
#include "../variables.h"
 

	
 
#ifdef __OS2__
 
#	include <sys/time.h> /* gettimeofday */
 
#	include <sys/types.h>
 
#	include <unistd.h>
 
#	include <conio.h>
 

	
 
#	define INCL_DOS
 
#	include <os2.h>
 

	
 
#	define STDIN 0  /* file descriptor for standard input */
 

	
 
/** 
 
 * Switches OpenTTD to a console app at run-time, instead of a PM app
 
 * Necessary to see stdout, etc. */
 
static void OS2_SwitchToConsoleMode(void)
 
{
 
	PPIB pib;
 
	PTIB tib;
 

	
 
	DosGetInfoBlocks(&tib, &pib);
 

	
 
	// Change flag from PM to VIO
 
	pib->pib_ultype = 3;
video/dedicated_v.h
Show inline comments
 
/* $Id$ */
 

	
 
#ifndef VIDEO_DEDICATED_H
 
#define VIDEO_DEDICATED_H
 

	
 
#include "hal.h"
 
#include "../hal.h"
 

	
 
extern const HalVideoDriver _dedicated_video_driver;
 

	
 
#endif
video/null_v.c
Show inline comments
 
/* $Id$ */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "gfx.h"
 
#include "variables.h"
 
#include "video/null_v.h"
 
#include "window.h"
 
#include "../stdafx.h"
 
#include "../openttd.h"
 
#include "../gfx.h"
 
#include "../variables.h"
 
#include "../window.h"
 
#include "null_v.h"
 

	
 
static void* _null_video_mem = NULL;
 

	
 
static const char* NullVideoStart(const char* const* parm)
 
{
 
	_screen.width = _screen.pitch = _cur_resolution[0];
 
	_screen.height = _cur_resolution[1];
 
	_null_video_mem = malloc(_cur_resolution[0] * _cur_resolution[1]);
 
	return NULL;
 
}
 

	
 
static void NullVideoStop(void) { free(_null_video_mem); }
 

	
 
static void NullVideoMakeDirty(int left, int top, int width, int height) {}
 

	
 
static int NullVideoMainLoop(void)
 
{
 
	uint i;
 

	
 
	for (i = 0; i < 1000; i++) {
 
		GameLoop();
 
		_screen.dst_ptr = _null_video_mem;
 
		UpdateWindows();
 
	}
video/null_v.h
Show inline comments
 
/* $Id$ */
 

	
 
#ifndef VIDEO_NULL_H
 
#define VIDEO_NULL_H
 

	
 
#include "hal.h"
 
#include "../hal.h"
 

	
 
extern const HalVideoDriver _null_video_driver;
 

	
 
#endif
video/sdl_v.c
Show inline comments
 
/* $Id$ */
 

	
 
#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 "video/sdl_v.h"
 
#include "../stdafx.h"
 

	
 
#ifdef WITH_SDL
 

	
 
#include "../openttd.h"
 
#include "../debug.h"
 
#include "../functions.h"
 
#include "../gfx.h"
 
#include "../macros.h"
 
#include "../sdl.h"
 
#include "../window.h"
 
#include "../network.h"
 
#include "../variables.h"
 
#include "sdl_v.h"
 
#include <SDL.h>
 
#include "network.h"
 
#include "variables.h"
 

	
 
static SDL_Surface *_sdl_screen;
 
static bool _all_modes;
 

	
 
#define MAX_DIRTY_RECTS 100
 
static SDL_Rect _dirty_rects[MAX_DIRTY_RECTS];
 
static int _num_dirty_rects;
 

	
 
static void SdlVideoMakeDirty(int left, int top, int width, int height)
 
{
 
//	printf("(%d,%d)-(%d,%d)\n", left, top, width, height);
 
//	_pixels_redrawn += width*height;
 
	if (_num_dirty_rects < MAX_DIRTY_RECTS) {
 
		_dirty_rects[_num_dirty_rects].x = left;
 
		_dirty_rects[_num_dirty_rects].y = top;
 
		_dirty_rects[_num_dirty_rects].w = width;
 
		_dirty_rects[_num_dirty_rects].h = height;
 
	}
 
	_num_dirty_rects++;
 
}
 

	
 
static SDL_Color pal[256];
 

	
 
static void UpdatePalette(uint start, uint end)
 
@@ -467,24 +470,26 @@ static int SdlVideoMainLoop(void)
 
	}
 
}
 

	
 
static bool SdlVideoChangeRes(int w, int h)
 
{
 
	return CreateMainSurface(w, h);
 
}
 

	
 
static void SdlVideoFullScreen(bool full_screen)
 
{
 
	_fullscreen = full_screen;
 
	GetVideoModes(); // get the list of available video modes
 
	if (!_video_driver->change_resolution(_cur_resolution[0], _cur_resolution[1]))
 
		_fullscreen ^= true; // switching resolution failed, put back full_screen to original status
 
}
 

	
 
const HalVideoDriver _sdl_video_driver = {
 
	SdlVideoStart,
 
	SdlVideoStop,
 
	SdlVideoMakeDirty,
 
	SdlVideoMainLoop,
 
	SdlVideoChangeRes,
 
	SdlVideoFullScreen,
 
};
 

	
 
#endif
video/sdl_v.h
Show inline comments
 
/* $Id$ */
 

	
 
#ifndef VIDEO_SDL_H
 
#define VIDEO_SDL_H
 

	
 
#include "hal.h"
 
#include "../hal.h"
 

	
 
extern const HalVideoDriver _sdl_video_driver;
 

	
 
#endif
video/win32_v.c
Show inline comments
 
/* $Id$ */
 

	
 
#include "stdafx.h"
 
#include "openttd.h"
 
#include "functions.h"
 
#include "gfx.h"
 
#include "macros.h"
 
#include "network.h"
 
#include "variables.h"
 
#include "window.h"
 
#include "video/win32_v.h"
 
#include "../stdafx.h"
 
#include "../openttd.h"
 
#include "../functions.h"
 
#include "../gfx.h"
 
#include "../macros.h"
 
#include "../network.h"
 
#include "../variables.h"
 
#include "../window.h"
 
#include "win32_v.h"
 
#include <windows.h>
 

	
 
static struct {
 
	HWND main_wnd;
 
	HBITMAP dib_sect;
 
	Pixel *bitmap_bits;
 
	Pixel *buffer_bits;
 
	Pixel *alloced_bits;
 
	HPALETTE gdi_palette;
 
	int width,height;
 
	int width_org, height_org;
 
	bool cursor_visible;
 
	bool switch_driver;
 
	bool fullscreen;
 
	bool double_size;
 
	bool has_focus;
 
	bool running;
 
} _wnd;
 

	
 
static void MakePalette(void)
 
{
 
	LOGPALETTE *pal;
 
	uint i;
 

	
video/win32_v.h
Show inline comments
 
/* $Id$ */
 

	
 
#ifndef VIDEO_WIN32_H
 
#define VIDEO_WIN32_H
 

	
 
#include "hal.h"
 
#include "../hal.h"
 

	
 
bool MyShowCursor(bool show);
 

	
 
extern const HalVideoDriver _win32_video_driver;
 

	
 
#endif
win32.c
Show inline comments
 
@@ -4,59 +4,56 @@
 
#include "openttd.h"
 
#include "debug.h"
 
#include "functions.h"
 
#include "macros.h"
 
#include "saveload.h"
 
#include "string.h"
 
#include "table/strings.h"
 
#include "gfx.h"
 
#include "window.h"
 
#include <windows.h>
 
#include <winnt.h>
 
#include <wininet.h>
 
#include <io.h>
 
#include <fcntl.h>
 
#include "variables.h"
 
#include "win32.h"
 

	
 
#include "driver.h"
 

	
 
#include "music/dmusic.h"
 
#include "music/null_m.h"
 
#include "music/win32_m.h"
 

	
 
#include "sound/null_s.h"
 
#include "sound/sdl_s.h"
 
#include "sound/win32_s.h"
 

	
 
#include "video/dedicated_v.h"
 
#include "video/null_v.h"
 
#include "video/sdl_v.h"
 
#include "video/win32_v.h"
 

	
 
#ifdef WITH_SDL
 
	#include "sound/sdl_s.h"
 
	#include "video/sdl_v.h"
 
#endif
 

	
 
static bool _has_console;
 

	
 
#if defined(__MINGW32__) || defined(__CYGWIN__)
 
	#define __TIMESTAMP__   __DATE__ __TIME__
 
#endif
 

	
 

	
 
// Helper function needed by dynamically loading SDL
 
bool LoadLibraryList(Function proc[], const char* dll)
 
{
 
	while (*dll != '\0') {
 
		HMODULE lib = LoadLibrary(dll);
 

	
 
		if (lib == NULL) return false;
 
		while (true) {
 
		  	FARPROC p;
 

	
 
			while (*dll++ != '\0');
 
			if (*dll == '\0') break;
 
			p = GetProcAddress(lib, dll);
 
			if (p == NULL) return false;
 
			*proc++ = (Function)p;
 
		}
 
		dll++;
0 comments (0 inline, 0 general)