mirror of https://github.com/OpenRCT2/OpenRCT2.git
Decompiled published credits window.
Renamed window_credits to window_music_credits. Added draw_string_centred_underline to gfx.c.
This commit is contained in:
parent
733c74a389
commit
6973b6586b
|
@ -129,6 +129,7 @@
|
|||
<ClCompile Include="..\src\window_new_ride.c" />
|
||||
<ClCompile Include="..\src\window_options.c" />
|
||||
<ClCompile Include="..\src\window_peep.c" />
|
||||
<ClCompile Include="..\src\window_publisher_credits.c" />
|
||||
<ClCompile Include="..\src\window_research.c" />
|
||||
<ClCompile Include="..\src\window_ride.c" />
|
||||
<ClCompile Include="..\src\window_ride_list.c" />
|
||||
|
@ -145,7 +146,7 @@
|
|||
<ClCompile Include="..\src\window_water.c" />
|
||||
<ClCompile Include="..\src\staff.c" />
|
||||
<ClCompile Include="..\src\window_scenery.c" />
|
||||
<ClCompile Include="..\src\window_credits.c" />
|
||||
<ClCompile Include="..\src\window_music_credits.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\openrct2.exe" />
|
||||
|
|
|
@ -395,7 +395,10 @@
|
|||
<ClCompile Include="..\src\window_ride.c">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\window_credits.c">
|
||||
<ClCompile Include="..\src\window_music_credits.c">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\window_publisher_credits.c">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
|
15
src/gfx.c
15
src/gfx.c
|
@ -2389,3 +2389,18 @@ void draw_string_right_underline(rct_drawpixelinfo *dpi, int format, void *args,
|
|||
if (text_palette[2] != 0)
|
||||
gfx_fill_rect(dpi, x + 1, y + 12, x + width + 1, y + 12, text_palette[2]);
|
||||
}
|
||||
|
||||
void draw_string_centred_underline(rct_drawpixelinfo *dpi, int format, void *args, int colour, int x, int y)
|
||||
{
|
||||
char buffer[128];
|
||||
int width;
|
||||
|
||||
format_string(buffer, format, args);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
|
||||
width = gfx_get_string_width(buffer);
|
||||
x -= width / 2;
|
||||
gfx_draw_string(dpi, buffer, colour, x, y);
|
||||
gfx_fill_rect(dpi, x, y + 11, x + width, y + 11, text_palette[1]);
|
||||
if (text_palette[2] != 0)
|
||||
gfx_fill_rect(dpi, x + 1, y + 12, x + width + 1, y + 12, text_palette[2]);
|
||||
}
|
|
@ -98,5 +98,6 @@ rct_drawpixelinfo* clip_drawpixelinfo(rct_drawpixelinfo* dpi, int left, int widt
|
|||
|
||||
void draw_string_left_underline(rct_drawpixelinfo *dpi, int format, void *args, int colour, int x, int y);
|
||||
void draw_string_right_underline(rct_drawpixelinfo *dpi, int format, void *args, int colour, int x, int y);
|
||||
void draw_string_centred_underline(rct_drawpixelinfo *dpi, int format, void *args, int colour, int x, int y);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -472,6 +472,7 @@ void window_cheats_open();
|
|||
void window_research_open();
|
||||
void window_scenery_open();
|
||||
void window_music_credits_open();
|
||||
void window_publisher_credits_open();
|
||||
|
||||
void window_guest_list_init_vars_a();
|
||||
void window_guest_list_init_vars_b();
|
||||
|
|
|
@ -128,7 +128,7 @@ static void window_about_mouseup()
|
|||
window_music_credits_open();
|
||||
break;
|
||||
case WIDX_PUBLISHER_CREDITS:
|
||||
RCT2_CALLPROC_EBPSAFE(0x0066D4EC);
|
||||
window_publisher_credits_open();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,212 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (c) 2014 Ted John
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* This file is part of OpenRCT2.
|
||||
*
|
||||
* OpenRCT2 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <windows.h>
|
||||
#include <string.h>
|
||||
#include "addresses.h"
|
||||
#include "string_ids.h"
|
||||
#include "sprites.h"
|
||||
#include "widget.h"
|
||||
#include "window.h"
|
||||
|
||||
enum WINDOW_PUBLISHER_CREDITS_WIDGET_IDX {
|
||||
WIDX_BACKGROUND,
|
||||
WIDX_TITLE,
|
||||
WIDX_CLOSE
|
||||
};
|
||||
|
||||
rct_widget window_publisher_credits_widgets[] = {
|
||||
{ WWT_FRAME, 0, 0, 419, 0, 383, 0x0FFFFFFFF, STR_NONE }, // panel / background
|
||||
{ WWT_CAPTION, 0, 1, 418, 1, 14, STR_ROLLERCOASTER_TYCOON_2, STR_WINDOW_TITLE_TIP }, // title bar
|
||||
{ WWT_CLOSEBOX, 0, 407, 417, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button
|
||||
{ WWT_SCROLL, 0, 4, 415, 18, 379, 2, STR_NONE }, // scroll
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
static void window_publisher_credits_emptysub() { }
|
||||
static void window_publisher_credits_mouseup();
|
||||
static void window_publisher_credits_scrollgetsize();
|
||||
static void window_publisher_credits_paint();
|
||||
static void window_publisher_credits_scrollpaint();
|
||||
|
||||
static void* window_publisher_credits_events[] = {
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_mouseup,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_scrollgetsize,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_emptysub,
|
||||
window_publisher_credits_paint,
|
||||
window_publisher_credits_scrollpaint
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0066D4EC
|
||||
*/
|
||||
void window_publisher_credits_open()
|
||||
{
|
||||
rct_window* window;
|
||||
|
||||
// Check if window is already open
|
||||
window = window_bring_to_front_by_id(WC_PUBLISHER_CREDITS, 0);
|
||||
if (window != NULL)
|
||||
return;
|
||||
|
||||
window = window_create(
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2 - 210,
|
||||
max(28, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) / 2 - 192),
|
||||
420,
|
||||
384,
|
||||
(uint32*)window_publisher_credits_events,
|
||||
WC_PUBLISHER_CREDITS,
|
||||
0
|
||||
);
|
||||
|
||||
window->widgets = window_publisher_credits_widgets;
|
||||
window->enabled_widgets = 1 << WIDX_CLOSE;
|
||||
|
||||
window_init_scroll_widgets(window);
|
||||
window->colours[0] = 7;
|
||||
window->colours[1] = 7;
|
||||
window->colours[2] = 7;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0066D7A8
|
||||
*/
|
||||
static void window_publisher_credits_mouseup()
|
||||
{
|
||||
short widgetIndex;
|
||||
rct_window *w;
|
||||
|
||||
window_widget_get_registers(w, widgetIndex);
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_CLOSE:
|
||||
window_close(w);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0066D7B3
|
||||
*/
|
||||
static void window_publisher_credits_scrollgetsize()
|
||||
{
|
||||
int y = 820;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
__asm mov edx, y
|
||||
#else
|
||||
__asm__("mov edx, %[y] " : [y] "+m" (y));
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0066D5CB
|
||||
*/
|
||||
static void window_publisher_credits_paint()
|
||||
{
|
||||
rct_window *w;
|
||||
rct_drawpixelinfo *dpi;
|
||||
|
||||
window_paint_get_registers(w, dpi);
|
||||
|
||||
window_draw_widgets(w, dpi);
|
||||
}
|
||||
|
||||
int credits_order[] = {
|
||||
0xB5D,
|
||||
0xB5E,
|
||||
0xB5F,
|
||||
0xB60,
|
||||
0xB61,
|
||||
0xB62,
|
||||
0xB63,
|
||||
0xB64,
|
||||
0xB72,
|
||||
0xB71,
|
||||
0xB65,
|
||||
0xB66,
|
||||
0xB6F,
|
||||
0xB70,
|
||||
0xB67,
|
||||
0xB68,
|
||||
0xB69,
|
||||
0xB6A,
|
||||
0xB6B,
|
||||
0xB6D,
|
||||
0xB6E,
|
||||
0xB6C,
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0066D5D1
|
||||
*/
|
||||
static void window_publisher_credits_scrollpaint()
|
||||
{
|
||||
rct_window *w;
|
||||
rct_drawpixelinfo *dpi;
|
||||
window_paint_get_registers(w, dpi);
|
||||
|
||||
int x = 200;
|
||||
int y = 2;
|
||||
|
||||
gfx_draw_sprite(dpi, SPR_CREDITS_INFOGRAMES, x - 49, y, 0);
|
||||
|
||||
y += 86;
|
||||
|
||||
draw_string_centred_underline(dpi, 0xB5C, 0, 0, x, y);
|
||||
|
||||
y += 14;
|
||||
|
||||
for (int i = 0; i < sizeof(credits_order)/sizeof(int); i++) {
|
||||
gfx_draw_string_centred(dpi, credits_order[i], x, y, 0, 0);
|
||||
y += 11;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue