本文整理汇总了C++中RCT2_GLOBAL函数的典型用法代码示例。如果您正苦于以下问题:C++ RCT2_GLOBAL函数的具体用法?C++ RCT2_GLOBAL怎么用?C++ RCT2_GLOBAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RCT2_GLOBAL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: osinterface_create_window
static void osinterface_create_window()
{
SDL_SysWMinfo wmInfo;
HWND hWnd;
int width, height;
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
fprintf(stderr, "Error: SDL_Init\n");
exit(-1);
}
// stuff
{
RCT2_CALLPROC_EBPSAFE(0x0068352C);
RCT2_CALLPROC_EBPSAFE(0x0068371D);
width = RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_RESOLUTION_WIDTH, sint16);
height = RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_RESOLUTION_HEIGHT, sint16);
width = 640;
height = 480;
}
RCT2_GLOBAL(0x009E2D8C, sint32) = 0;
_window = SDL_CreateWindow("OpenRCT2", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_RESIZABLE);
// Get the HWND context
SDL_GetWindowWMInfo(_window, &wmInfo);
hWnd = wmInfo.info.win.window;
RCT2_GLOBAL(0x009E2D70, HWND) = hWnd;
// Set the update palette function pointer
RCT2_GLOBAL(0x009E2BE4, update_palette_func) = osinterface_update_palette;
// Initialise the surface, palette and draw buffer
osinterface_resize(width, height);
}
示例2: window_cheats_mouseup
static void window_cheats_mouseup()
{
int i;
short widgetIndex;
rct_window *w;
__asm mov widgetIndex, dx
__asm mov w, esi
switch (widgetIndex) {
case WIDX_CLOSE:
window_close(w);
break;
case WIDX_HIGH_MONEY:
i = DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32));
i += 100000;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32) = ENCRYPT_MONEY(i);
window_invalidate_by_id(0x40 | WC_BOTTOM_TOOLBAR, 0);
break;
}
}
示例3: osinterface_open_common_file_dialog
/**
*
* rct2: 0x004080EA
*/
int osinterface_open_common_file_dialog(int type, char *title, char *filename, char *filterPattern, char *filterName)
{
char initialDirectory[MAX_PATH], *dotAddress, *slashAddress;
OPENFILENAME openFileName;
BOOL result;
int tmp;
DWORD commonFlags;
// Get directory path from given filename
strcpy(initialDirectory, filename);
dotAddress = strrchr(initialDirectory, '.');
if (dotAddress != NULL) {
slashAddress = strrchr(initialDirectory, '\\');
if (slashAddress < dotAddress)
*(slashAddress + 1) = 0;
}
// Clear filename
if (type != 0)
*filename = 0;
// Set open file name options
memset(&openFileName, 0, sizeof(OPENFILENAME));
openFileName.lStructSize = sizeof(OPENFILENAME);
openFileName.hwndOwner = RCT2_GLOBAL(0x009E2D70, HWND);
openFileName.lpstrFile = filename;
openFileName.nMaxFile = MAX_PATH;
openFileName.lpstrInitialDir = initialDirectory;
openFileName.lpstrTitle = title;
// Copy filter name
strcpy((char*)0x01423800, filterName);
// Copy filter pattern
strcpy((char*)0x01423800 + strlen(filterName) + 1, filterPattern);
*((char*)(0x01423800 + strlen(filterName) + 1 + strlen(filterPattern) + 1)) = 0;
openFileName.lpstrFilter = (char*)0x01423800;
//
tmp = RCT2_GLOBAL(0x009E2C74, uint32);
if (RCT2_GLOBAL(0x009E2BB8, uint32) == 2 && RCT2_GLOBAL(0x009E1AF8, uint32) == 1)
RCT2_GLOBAL(0x009E2C74, uint32) = 1;
// Open dialog
commonFlags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
if (type == 0) {
openFileName.Flags = commonFlags | OFN_CREATEPROMPT | OFN_OVERWRITEPROMPT;
result = GetSaveFileName(&openFileName);
} else if (type == 1) {
openFileName.Flags = commonFlags | OFN_NONETWORKBUTTON | OFN_FILEMUSTEXIST;
result = GetOpenFileName(&openFileName);
}
//
RCT2_GLOBAL(0x009E2C74, uint32) = tmp;
return result;
}
示例4: game_handle_key_scroll
void game_handle_key_scroll()
{
rct_window *mainWindow;
int scrollX, scrollY;
mainWindow = window_get_main();
if (mainWindow == NULL)
return;
if ((mainWindow->flags & WF_2) || (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 9))
return;
if (mainWindow->viewport == NULL)
return;
scrollX = 0;
scrollY = 0;
// Scroll left / right
if (gKeysState[SDL_SCANCODE_LEFT])
scrollX = -1;
else if (gKeysState[SDL_SCANCODE_RIGHT])
scrollX = 1;
// Scroll up / down
if (gKeysState[SDL_SCANCODE_UP])
scrollY = -1;
else if (gKeysState[SDL_SCANCODE_DOWN])
scrollY = 1;
// Scroll viewport
if (scrollX != 0) {
mainWindow->saved_view_x += scrollX * (12 << mainWindow->viewport->zoom);
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 7);
}
if (scrollY != 0) {
mainWindow->saved_view_y += scrollY * (12 << mainWindow->viewport->zoom);
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 7);
}
}
示例5: window_track_list_invalidate
/**
*
* rct2: 0x006CF2D6
*/
static void window_track_list_invalidate(rct_window *w)
{
rct_ride_entry *entry;
rct_string_id stringId;
colour_scheme_update(w);
entry = get_ride_entry(_window_track_list_item.entry_index);
stringId = entry->name;
if (!(entry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) || rideTypeShouldLoseSeparateFlag(entry))
stringId = _window_track_list_item.type + 2;
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = stringId;
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) {
window_track_list_widgets[WIDX_TITLE].image = STR_TRACK_DESIGNS;
window_track_list_widgets[WIDX_TRACK_LIST].tooltip = STR_CLICK_ON_DESIGN_TO_RENAME_OR_DELETE_IT;
} else {
window_track_list_widgets[WIDX_TITLE].image = STR_SELECT_DESIGN;
window_track_list_widgets[WIDX_TRACK_LIST].tooltip = STR_CLICK_ON_DESIGN_TO_BUILD_IT_TIP;
}
if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER) || w->track_list.var_482 != 0) {
w->pressed_widgets |= 1 << WIDX_TRACK_PREVIEW;
w->disabled_widgets &= ~(1 << WIDX_TRACK_PREVIEW);
window_track_list_widgets[WIDX_ROTATE].type = WWT_FLATBTN;
window_track_list_widgets[WIDX_TOGGLE_SCENERY].type = WWT_FLATBTN;
if (RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE, uint8) == 0)
w->pressed_widgets |= (1 << WIDX_TOGGLE_SCENERY);
else
w->pressed_widgets &= ~(1 << WIDX_TOGGLE_SCENERY);
} else {
w->pressed_widgets &= ~(1 << WIDX_TRACK_PREVIEW);
w->disabled_widgets |= (1 << WIDX_TRACK_PREVIEW);
window_track_list_widgets[WIDX_ROTATE].type = WWT_EMPTY;
window_track_list_widgets[WIDX_TOGGLE_SCENERY].type = WWT_EMPTY;
}
}
示例6: widget_draw_image
/**
*
* rct2: 0x006EB951
*/
static void widget_draw_image(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
{
int l, t, r, b, colour, image;
rct_widget *widget;
// Get the widget
widget = &w->widgets[widgetIndex];
// Get the image
image = widget->image;
if (image == -1)
return;
// Resolve the absolute ltrb
l = w->x + widget->left;
t = w->y + widget->top;
r = w->x + widget->right;
b = w->y + widget->bottom;
// Get the colour
colour = w->colours[widget->colour];
if (widget->type == WWT_4 || widget->type == WWT_6 || widget->type == WWT_TRNBTN || widget->type == WWT_TAB)
if (widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex))
image++;
if (widget_is_disabled(w, widgetIndex)) {
// Draw greyed out (light border bottom right shadow)
colour = w->colours[widget->colour];
colour = RCT2_ADDRESS(0x00141FC4A, uint8)[(colour & 0x7F) * 8] & 0xFF;
RCT2_GLOBAL(0x009ABDA4, uint32) = 0x009DED74;
memset(0x009DED74, colour, 256);
RCT2_GLOBAL(0x009DED74, uint8) = 0;
RCT2_GLOBAL(0x00EDF81C, uint32) = 0x20000000;
image &= 0x7FFFF;
RCT2_CALLPROC_X(0x0067A46E, 0, image, l + 1, t + 1, 0, dpi, 0);
// Draw greyed out (dark)
colour = w->colours[widget->colour];
colour = RCT2_ADDRESS(0x00141FC48, uint8)[(colour & 0x7F) * 8] & 0xFF;
RCT2_GLOBAL(0x009ABDA4, uint32) = 0x009DED74;
memset(0x009DED74, colour, 256);
RCT2_GLOBAL(0x009DED74, uint8) = 0;
RCT2_GLOBAL(0x00EDF81C, uint32) = 0x20000000;
RCT2_CALLPROC_X(0x0067A46E, 0, image, l, t, 0, dpi, 0);
} else {
if (image & 0x80000000) {
// ?
}
if (image & 0x40000000)
image &= ~0x40000000;
else
image |= colour << 19;
gfx_draw_sprite(dpi, image, l, t);
}
}
示例7: game_handle_edge_scroll
void game_handle_edge_scroll()
{
rct_window *mainWindow;
int scrollX, scrollY;
mainWindow = window_get_main();
if (mainWindow == NULL)
return;
if ((mainWindow->flags & WF_2) || (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 9))
return;
if (mainWindow->viewport == NULL)
return;
scrollX = 0;
scrollY = 0;
// Scroll left / right
if (gCursorState.x == 0)
scrollX = -1;
else if (gCursorState.x == RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 1)
scrollX = 1;
// Scroll up / down
if (gCursorState.y == 0)
scrollY = -1;
else if (gCursorState.y == RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - 1)
scrollY = 1;
// Scroll viewport
if (scrollX != 0) {
mainWindow->saved_view_x += scrollX * (12 << mainWindow->viewport->zoom);
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 7);
}
if (scrollY != 0) {
mainWindow->saved_view_y += scrollY * (12 << mainWindow->viewport->zoom);
RCT2_GLOBAL(0x009DE518, uint32) |= (1 << 7);
}
}
示例8: osinterface_progressbar_create
/**
*
* rct2: 0x00407E6E
*/
int osinterface_progressbar_create(char* title, int a2)
{
DWORD style = WS_VISIBLE | WS_BORDER | WS_DLGFRAME;
if (a2) {
style = WS_VISIBLE | WS_BORDER | WS_DLGFRAME | PBS_SMOOTH;
}
int width = 340;
int height = GetSystemMetrics(SM_CYCAPTION) + 24;
HWND hwnd = CreateWindowExA(WS_EX_TOPMOST | WS_EX_DLGMODALFRAME, "msctls_progress32", title, style, (RCT2_GLOBAL(0x01423C08, sint32) - width) / 2, (RCT2_GLOBAL(0x01423C0C, sint32) - height) / 2, width, height, 0, 0, RCT2_GLOBAL(RCT2_ADDRESS_HINSTANCE, HINSTANCE), 0);
RCT2_GLOBAL(RCT2_ADDRESS_PROGRESSBAR_HWND, HWND) = hwnd;
if (hwnd) {
RCT2_GLOBAL(0x009E2DFC, uint32) = 1;
if (RCT2_GLOBAL(RCT2_ADDRESS_HFONT, HFONT)) {
SendMessageA(hwnd, WM_SETFONT, (WPARAM)RCT2_GLOBAL(RCT2_ADDRESS_HFONT, HFONT), 1);
}
SetWindowTextA(hwnd, title);
osinterface_progressbar_setmax(0xFF);
osinterface_progressbar_setpos(0);
return 1;
} else {
return 0;
}
}
示例9: window_shortcut_change_open
void window_shortcut_change_open(int selected_key){
// Move this to window_shortcut_change_open
window_close_by_class(WC_CHANGE_KEYBOARD_SHORTCUT);
// Save the item we are selecting for new window
RCT2_GLOBAL(0x9DE511, uint8) = selected_key;
rct_window* w = window_create_auto_pos(WW, WH, (uint32*)window_shortcut_change_events, WC_CHANGE_KEYBOARD_SHORTCUT, 0);
w->widgets = window_shortcut_change_widgets;
w->enabled_widgets = (1 << 2);
window_init_scroll_widgets(w);
w->colours[0] = 7;
w->colours[1] = 7;
w->colours[2] = 7;
}
示例10: window_banner_dropdown
/* rct2: 0x6ba517 */
static void window_banner_dropdown()
{
short widgetIndex, dropdownIndex;
rct_window* w;
window_dropdown_get_registers(w, widgetIndex, dropdownIndex);
rct_banner* banner = &gBanners[w->number];
switch(widgetIndex){
case WIDX_MAIN_COLOR:
if ( dropdownIndex == 0xFFFF) return;
banner->colour = (uint8)dropdownIndex;
window_invalidate(w);
break;
case WIDX_TEXT_COLOR_DROPDOWN_BUTTON:
if ( dropdownIndex == 0xFFFF) return;
banner->text_colour = dropdownIndex + 1;
//Can be replaced with a buffer 34 chars wide ( 32 character + 1 colour_format + 1 '\0')
uint8* text_buffer = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, uint8);
format_string(text_buffer, banner->string_idx, 0);
if (text_buffer[0] < FORMAT_COLOUR_CODE_START
|| text_buffer[0] > FORMAT_COLOUR_CODE_END){
int end_point = strlen(text_buffer) + 1;
strncpy(text_buffer + 1, text_buffer, 32);
text_buffer[end_point] = '\0';
}
text_buffer[0] = banner->text_colour + FORMAT_COLOUR_CODE_START;
int string_id = 0, ebx = 0, ecx = 128, edx = 0, ebp = 0, esi = 0;
// Allocate text_buffer to a new string_id?
RCT2_CALLFUNC_X(0x6C421D, &string_id, &ebx, &ecx, &edx, &esi, (int*)&text_buffer, &ebp);
if (string_id){
rct_string_id prev_string_id = banner->string_idx;
banner->string_idx = string_id;
// De-allocate previous string id?
RCT2_CALLPROC_X(0x6C42AC, prev_string_id, 0, 0, 0, 0, 0, 0);
window_invalidate(w);
}
else{
window_error_open(2984, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id));
}
break;
}
}
示例11: window_changelog_resize
static void window_changelog_resize()
{
rct_window *w;
window_get_register(w);
int screenWidth = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16);
int screenHeight = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16);
w->max_width = (screenWidth * 4) / 5;
w->max_height = (screenHeight * 4) / 5;
w->min_width = MIN_WW;
w->min_height = MIN_WH;
if (w->width < w->min_width) {
window_invalidate(w);
w->width = w->min_width;
}
if (w->height < w->min_height) {
window_invalidate(w);
w->height = w->min_height;
}
}
示例12: window_network_status_paint
static void window_network_status_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
window_draw_widgets(w, dpi);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
char buffer[sizeof(window_network_status_text) + 10];
char* lineCh = buffer;
lineCh = utf8_write_codepoint(lineCh, FORMAT_BLACK);
strcpy(lineCh, window_network_status_text);
gfx_clip_string(buffer, 230);
int x = w->x + (w->width / 2);
int y = w->y + (w->height / 2);
x -= gfx_get_string_width(buffer) / 2;
gfx_draw_string(dpi, buffer, 0, x, y);
}
示例13: window_land_rights_open
void window_land_rights_open()
{
rct_window* window;
// Check if window is already open
if (window_find_by_class(WC_LAND_RIGHTS) != NULL)
return;
window = window_create(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - 98, 29, 98, 94, &window_land_rights_events, WC_LAND_RIGHTS, 0);
window->widgets = window_land_rights_widgets;
window->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_DECREMENT) | (1 << WIDX_INCREMENT) | (1 << WIDX_PREVIEW) |
(1 << WIDX_BUY_LAND_RIGHTS) | (1 << WIDX_BUY_CONSTRUCTION_RIGHTS);
window_init_scroll_widgets(window);
window_push_others_below(window);
LandRightsMode = true;
window->pressed_widgets = (1 << WIDX_BUY_LAND_RIGHTS);
RCT2_GLOBAL(RCT2_ADDRESS_WATER_RAISE_COST, uint32) = MONEY32_UNDEFINED;
RCT2_GLOBAL(RCT2_ADDRESS_WATER_LOWER_COST, uint32) = MONEY32_UNDEFINED;
show_land_rights();
}
示例14: window_changelog_read_file
static bool window_changelog_read_file()
{
window_changelog_dispose_file();
utf8 path[MAX_PATH];
sprintf(path, "%s%cchangelog.txt", gExePath, platform_get_path_separator());
if (!readentirefile(path, (void**)&_changelogText, (int*)&_changelogTextSize)) {
log_error("Unable to read changelog.txt");
return false;
}
_changelogText = realloc(_changelogText, _changelogTextSize + 1);
_changelogText[_changelogTextSize++] = 0;
char *start = _changelogText;
if (_changelogTextSize >= 3 && utf8_is_bom(_changelogText))
start += 3;
int changelogLinesCapacity = 8;
_changelogLines = malloc(changelogLinesCapacity * sizeof(char*));
_changelogLines[0] = start;
_changelogNumLines = 1;
char *ch = start;
while (*ch != 0) {
unsigned char c = *ch;
if (c == '\n') {
*ch++ = 0;
_changelogNumLines++;
if (_changelogNumLines > changelogLinesCapacity) {
changelogLinesCapacity *= 2;
_changelogLines = realloc(_changelogLines, changelogLinesCapacity * sizeof(char*));
}
_changelogLines[_changelogNumLines - 1] = ch;
} else if (c < 32 || c > 122) {
// A character that won't be drawn or change state.
*ch++ = FORMAT_OUTLINE_OFF;
} else {
ch++;
}
}
_changelogLines = realloc(_changelogLines, _changelogNumLines * sizeof(char*));
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
_changelogLongestLineWidth = 0;
for (int i = 0; i < _changelogNumLines; i++) {
int width = gfx_get_string_width(_changelogLines[i]);
_changelogLongestLineWidth = max(width, _changelogLongestLineWidth);
}
return true;
}
示例15: title_load_park
static int title_load_park(const char *path)
{
rct_window* w;
int successfulLoad = 0;
if (_strcmpi(path_get_extension(path), ".sv6") == 0) {
SDL_RWops* rw = SDL_RWFromFile(path, "rb");
if (rw != NULL) {
successfulLoad = game_load_sv6(rw);
SDL_RWclose(rw);
}
} else {
successfulLoad = scenario_load(path);
}
if (!successfulLoad)
return 0;
w = window_get_main();
w->viewport_target_sprite = -1;
w->saved_view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16);
w->saved_view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16);
{
char _cl = (RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) & 0xFF) - w->viewport->zoom;
w->viewport->zoom = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) & 0xFF;
*((char*)(&RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32))) = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) >> 8;
if (_cl != 0) {
if (_cl < 0) {
_cl = -_cl;
w->viewport->view_width >>= _cl;
w->viewport->view_height >>= _cl;
} else {
w->viewport->view_width <<= _cl;
w->viewport->view_height <<= _cl;
}
}