mirror of https://github.com/OpenRCT2/OpenRCT2.git
commit
4e578aeaf2
|
@ -12,8 +12,7 @@
|
|||
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommand>$(TargetDir)\openrct2.exe</LocalDebuggerCommand>
|
||||
<LocalDebuggerCommandArguments>
|
||||
</LocalDebuggerCommandArguments>
|
||||
<LocalDebuggerCommandArguments></LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release with Tests|Win32'">
|
||||
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "../world/sprite.h"
|
||||
#include "audio.h"
|
||||
#include "mixer.h"
|
||||
#include "../openrct2.h"
|
||||
|
||||
int gAudioDeviceCount;
|
||||
audio_device *gAudioDevices = NULL;
|
||||
|
@ -1835,7 +1836,7 @@ void unpause_sounds()
|
|||
*/
|
||||
void stop_vehicle_sounds()
|
||||
{
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, sint32) != -1) {
|
||||
if (!gOpenRCT2Headless && RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, sint32) != -1) {
|
||||
for (int i = 0; i < countof(gVehicleSoundList)/*7*/; i++) {
|
||||
rct_vehicle_sound* vehicle_sound = &gVehicleSoundList[i];
|
||||
//rct_vehicle_sound* vehicle_sound = &RCT2_ADDRESS(RCT2_ADDRESS_VEHICLE_SOUND_LIST, rct_vehicle_sound)[i];
|
||||
|
|
|
@ -71,12 +71,13 @@ static const char *const usage[] = {
|
|||
int cmdline_run(const char **argv, int argc)
|
||||
{
|
||||
//
|
||||
int version = 0, verbose = 0, width = 0, height = 0, port = 0;
|
||||
int version = 0, headless = 0, verbose = 0, width = 0, height = 0, port = 0;
|
||||
char *server = NULL;
|
||||
|
||||
argparse_option_t options[] = {
|
||||
OPT_HELP(),
|
||||
OPT_BOOLEAN('v', "version", &version, "show version information and exit"),
|
||||
OPT_BOOLEAN(0, "headless", &headless, "run OpenRCT2 headless"),
|
||||
OPT_BOOLEAN(0, "verbose", &verbose, "log verbose messages"),
|
||||
OPT_INTEGER('m', "mode", &sprite_mode, "the type of sprite conversion. 0 = default, 1 = simple closest pixel match, 2 = dithering"),
|
||||
OPT_STRING(0, "server", &server, "server to connect to"),
|
||||
|
@ -95,6 +96,9 @@ int cmdline_run(const char **argv, int argc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (headless)
|
||||
gOpenRCT2Headless = true;
|
||||
|
||||
if (verbose)
|
||||
_log_levels[DIAGNOSTIC_LEVEL_VERBOSE] = 1;
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "world/map.h"
|
||||
#include "world/sprite.h"
|
||||
#include "world/scenery.h"
|
||||
#include "openrct2.h"
|
||||
|
||||
static int _dragX, _dragY;
|
||||
static rct_windowclass _dragWindowClass;
|
||||
|
@ -1331,7 +1332,7 @@ void game_handle_keyboard_input()
|
|||
|
||||
|
||||
// Handle key input
|
||||
while ((key = get_next_key()) != 0) {
|
||||
while (!gOpenRCT2Headless && (key = get_next_key()) != 0) {
|
||||
if (key == 255)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -184,59 +184,64 @@ void platform_draw()
|
|||
int width = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16);
|
||||
int height = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16);
|
||||
|
||||
if (gConfigGeneral.hardware_display) {
|
||||
void *pixels;
|
||||
int pitch;
|
||||
if (SDL_LockTexture(gBufferTexture, NULL, &pixels, &pitch) == 0) {
|
||||
uint8 *src = (uint8*)_screenBuffer;
|
||||
int padding = pitch - (width * 4);
|
||||
if (pitch == width * 4) {
|
||||
uint32 *dst = pixels;
|
||||
for (int i = width * height; i > 0; i--) { *dst++ = *(uint32 *)(&gPaletteHWMapped[*src++]); }
|
||||
} else
|
||||
if (pitch == (width * 2) + padding) {
|
||||
uint16 *dst = pixels;
|
||||
for (int y = height; y > 0; y++) {
|
||||
for (int x = width; x > 0; x--) { *dst++ = *(uint16 *)(&gPaletteHWMapped[*src++]); }
|
||||
dst = (uint16*)(((uint8 *)dst) + padding);
|
||||
if (!gOpenRCT2Headless) {
|
||||
if (gConfigGeneral.hardware_display) {
|
||||
void *pixels;
|
||||
int pitch;
|
||||
if (SDL_LockTexture(gBufferTexture, NULL, &pixels, &pitch) == 0) {
|
||||
uint8 *src = (uint8*)_screenBuffer;
|
||||
int padding = pitch - (width * 4);
|
||||
if (pitch == width * 4) {
|
||||
uint32 *dst = pixels;
|
||||
for (int i = width * height; i > 0; i--) { *dst++ = *(uint32 *)(&gPaletteHWMapped[*src++]); }
|
||||
}
|
||||
} else
|
||||
if (pitch == width + padding) {
|
||||
uint8 *dst = pixels;
|
||||
for (int y = height; y > 0; y++) {
|
||||
for (int x = width; x > 0; x--) { *dst++ = *(uint8 *)(&gPaletteHWMapped[*src++]); }
|
||||
dst += padding;
|
||||
else
|
||||
if (pitch == (width * 2) + padding) {
|
||||
uint16 *dst = pixels;
|
||||
for (int y = height; y > 0; y++) {
|
||||
for (int x = width; x > 0; x--) { *dst++ = *(uint16 *)(&gPaletteHWMapped[*src++]); }
|
||||
dst = (uint16*)(((uint8 *)dst) + padding);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (pitch == width + padding) {
|
||||
uint8 *dst = pixels;
|
||||
for (int y = height; y > 0; y++) {
|
||||
for (int x = width; x > 0; x--) { *dst++ = *(uint8 *)(&gPaletteHWMapped[*src++]); }
|
||||
dst += padding;
|
||||
}
|
||||
}
|
||||
SDL_UnlockTexture(gBufferTexture);
|
||||
}
|
||||
|
||||
SDL_RenderCopy(gRenderer, gBufferTexture, NULL, NULL);
|
||||
SDL_RenderPresent(gRenderer);
|
||||
}
|
||||
else {
|
||||
// Lock the surface before setting its pixels
|
||||
if (SDL_MUSTLOCK(_surface)) {
|
||||
if (SDL_LockSurface(_surface) < 0) {
|
||||
log_error("locking failed %s", SDL_GetError());
|
||||
return;
|
||||
}
|
||||
}
|
||||
SDL_UnlockTexture(gBufferTexture);
|
||||
}
|
||||
|
||||
SDL_RenderCopy(gRenderer, gBufferTexture, NULL, NULL);
|
||||
SDL_RenderPresent(gRenderer);
|
||||
} else {
|
||||
// Lock the surface before setting its pixels
|
||||
if (SDL_MUSTLOCK(_surface)) {
|
||||
if (SDL_LockSurface(_surface) < 0) {
|
||||
log_error("locking failed %s", SDL_GetError());
|
||||
return;
|
||||
// Copy pixels from the virtual screen buffer to the surface
|
||||
memcpy(_surface->pixels, _screenBuffer, _surface->pitch * _surface->h);
|
||||
|
||||
// Unlock the surface
|
||||
if (SDL_MUSTLOCK(_surface))
|
||||
SDL_UnlockSurface(_surface);
|
||||
|
||||
// Copy the surface to the window
|
||||
if (SDL_BlitSurface(_surface, NULL, SDL_GetWindowSurface(gWindow), NULL)) {
|
||||
log_fatal("SDL_BlitSurface %s", SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
if (SDL_UpdateWindowSurface(gWindow)) {
|
||||
log_fatal("SDL_UpdateWindowSurface %s", SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Copy pixels from the virtual screen buffer to the surface
|
||||
memcpy(_surface->pixels, _screenBuffer, _surface->pitch * _surface->h);
|
||||
|
||||
// Unlock the surface
|
||||
if (SDL_MUSTLOCK(_surface))
|
||||
SDL_UnlockSurface(_surface);
|
||||
|
||||
// Copy the surface to the window
|
||||
if (SDL_BlitSurface(_surface, NULL, SDL_GetWindowSurface(gWindow), NULL)) {
|
||||
log_fatal("SDL_BlitSurface %s", SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
if (SDL_UpdateWindowSurface(gWindow)) {
|
||||
log_fatal("SDL_UpdateWindowSurface %s", SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "ride.h"
|
||||
#include "ride_data.h"
|
||||
#include "vehicle.h"
|
||||
#include "../openrct2.h"
|
||||
|
||||
static void vehicle_update(rct_vehicle *vehicle);
|
||||
|
||||
|
@ -167,7 +168,7 @@ int sub_6BC2F3(rct_vehicle* vehicle)
|
|||
*/
|
||||
void vehicle_sounds_update()
|
||||
{
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) != -1 && !gGameSoundsOff && gConfigSound.sound) {
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_SOUND_DEVICE, uint32) != -1 && !gGameSoundsOff && gConfigSound.sound && !gOpenRCT2Headless) {
|
||||
RCT2_GLOBAL(0x00F438A4, rct_viewport*) = (rct_viewport*)-1;
|
||||
rct_viewport* viewport = (rct_viewport*)-1;
|
||||
rct_window* window = RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*);
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "map_animation.h"
|
||||
#include "park.h"
|
||||
#include "scenery.h"
|
||||
#include "../openrct2.h"
|
||||
|
||||
/* Replaces 0x00993CCC & 0x00993CCE */
|
||||
const rct_xy16 TileDirectionDelta[] = {
|
||||
|
@ -3847,7 +3848,7 @@ void map_invalidate_tile_under_zoom(int x, int y, int z0, int z1, int maxZoom)
|
|||
y2 = y + 32 - z0;
|
||||
|
||||
viewport = RCT2_GLOBAL(RCT2_ADDRESS_ACTIVE_VIEWPORT_PTR_ARRAY, rct_viewport*);
|
||||
while (viewport->width != 0) {
|
||||
while (!gOpenRCT2Headless && viewport->width != 0) {
|
||||
if (maxZoom == -1 || viewport->zoom <= maxZoom) {
|
||||
viewport_invalidate(viewport, x1, y1, x2, y2);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue