本文整理汇总了C++中RCT2_GLOBAL函数的典型用法代码示例。如果您正苦于以下问题:C++ RCT2_GLOBAL函数的具体用法?C++ RCT2_GLOBAL怎么用?C++ RCT2_GLOBAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RCT2_GLOBAL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:benpye,项目名称:OpenRCT2,代码行数:39,代码来源:osinterface.c
示例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;
}
}
开发者ID:newpolaris,项目名称:OpenRCT2,代码行数:22,代码来源:window_cheats.c
示例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;
}
开发者ID:jcdavis,项目名称:OpenRCT2,代码行数:62,代码来源:osinterface.c
示例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);
}
}
开发者ID:jvlomax,项目名称:OpenRCT2,代码行数:38,代码来源:game.c
示例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;
}
}
开发者ID:1337Noob1337,项目名称:OpenRCT2,代码行数:42,代码来源:track_list.c
示例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);
}
}
开发者ID:Philpax,项目名称:OpenRCT2,代码行数:62,代码来源:widget.c
示例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);
}
}
开发者ID:jvlomax,项目名称:OpenRCT2,代码行数:38,代码来源:game.c
示例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;
}
}
开发者ID:jcdavis,项目名称:OpenRCT2,代码行数:27,代码来源:osinterface.c
示例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;
}
开发者ID:Achilleshiel,项目名称:OpenRCT2,代码行数:14,代码来源:shortcut_key_change.c
示例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;
}
}
开发者ID:deadspaceXD,项目名称:OpenRCT2,代码行数:51,代码来源:banner.c
示例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;
}
}
开发者ID:MaikelS11,项目名称:OpenRCT2,代码行数:23,代码来源:changelog.c
示例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);
}
开发者ID:Aitchwing,项目名称:OpenRCT2,代码行数:14,代码来源:network_status.c
示例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();
}
开发者ID:Aitchwing,项目名称:OpenRCT2,代码行数:23,代码来源:land_rights.c
示例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;
}
开发者ID:1337Noob1337,项目名称:OpenRCT2,代码行数:50,代码来源:changelog.c
示例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;
}
}
开发者ID:janisozaur,项目名称:rct-release-test,代码行数:37,代码来源:title.c
示例16: marketing_update
/**
* Update status of marketing campaigns and send produce a news item when they have finished.
* rct2: 0x0069E0C1
*/
void marketing_update()
{
for (int campaign = 0; campaign < ADVERTISING_CAMPAIGN_COUNT; campaign++) {
if (gCheatsNeverendingMarketing)
continue;
int active = (gMarketingCampaignDaysLeft[campaign] & CAMPAIGN_ACTIVE_FLAG) != 0;
if (gMarketingCampaignDaysLeft[campaign] == 0)
continue;
window_invalidate_by_class(WC_FINANCES);
// High bit marks the campaign as inactive, on first check the campaign is set active
// this makes campaigns run a full x weeks even when started in the middle of a week
gMarketingCampaignDaysLeft[campaign] &= ~CAMPAIGN_ACTIVE_FLAG;
if (active)
continue;
if (--gMarketingCampaignDaysLeft[campaign] != 0)
continue;
int campaignItem = gMarketingCampaignRideIndex[campaign];
// This sets the string parameters for the marketing types that have an argument.
if (campaign == ADVERTISING_CAMPAIGN_RIDE_FREE || campaign == ADVERTISING_CAMPAIGN_RIDE) {
rct_ride* ride = get_ride(campaignItem);
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ride->name;
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments;
} else if (campaign == ADVERTISING_CAMPAIGN_FOOD_OR_DRINK_FREE) {
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ShopItemStringIds[campaignItem].plural;
}
if (gConfigNotifications.park_marketing_campaign_finished) {
news_item_add_to_queue(NEWS_ITEM_MONEY, STR_MARKETING_FINISHED_BASE + campaign, 0);
}
}
}
开发者ID:1337Noob1337,项目名称:OpenRCT2,代码行数:41,代码来源:marketing.c
示例17: window_tooltip_reset
void window_tooltip_reset(int x, int y)
{
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_CURSOR_X, uint16) = x;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_CURSOR_Y, uint16) = y;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_CLASS, uint8) = 255;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, uint8) = 1;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~(1 << 4);
}
开发者ID:Aitchwing,项目名称:OpenRCT2,代码行数:9,代码来源:tooltip.c
示例18: game_get_next_input
/**
*
* rct2: 0x006E83C7
*/
static void game_get_next_input(int *x, int *y, int *state)
{
int eax, ebx, ecx, edx, esi, edi, ebp;
RCT2_CALLFUNC_X(0x00407074, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
if (eax == 0) {
*x = gCursorState.x;
*y = gCursorState.y;
*state = 0;
return;
}
*x = RCT2_GLOBAL(eax + 0, sint32);
*y = RCT2_GLOBAL(eax + 4, sint32);
*state = RCT2_GLOBAL(eax + 8, sint32);
//int eax, ebx, ecx, edx, esi, edi, ebp;
//RCT2_CALLFUNC_X(0x006E83C7, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
//*x = eax & 0xFFFF;
//*y = ebx & 0xFFFF;
//*state = ecx & 0xFF;
//return;
//int on_tutorial = RCT2_GLOBAL(RCT2_ADDRESS_ON_TUTORIAL, uint8);
//if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 5)) {
// if (on_tutorial == 1) {
// } else {
// RCT2_CALLPROC_EBPSAFE(0x00407074);
// }
// if (on_tutorial == 2) {
// }
//} else {
//}
}
开发者ID:GokuMizuno,项目名称:OpenRCT2,代码行数:41,代码来源:game.c
示例19: osinterface_resize
static void osinterface_resize(int width, int height)
{
rct_drawpixelinfo *screenDPI;
int newScreenBufferSize;
void *newScreenBuffer;
if (_surface != NULL)
SDL_FreeSurface(_surface);
if (_palette != NULL)
SDL_FreePalette(_palette);
_surface = SDL_CreateRGBSurface(0, width, height, 8, 0, 0, 0, 0);
_palette = SDL_AllocPalette(256);
SDL_SetSurfacePalette(_surface, _palette);
newScreenBufferSize = _surface->pitch * _surface->h;
newScreenBuffer = malloc(newScreenBufferSize);
if (_screenBuffer == NULL) {
memset(newScreenBuffer, 0, newScreenBufferSize);
} else {
memcpy(newScreenBuffer, _screenBuffer, min(_screenBufferSize, newScreenBufferSize));
if (newScreenBufferSize - _screenBufferSize > 0)
memset((uint8*)newScreenBuffer + _screenBufferSize, 0, newScreenBufferSize - _screenBufferSize);
free(_screenBuffer);
}
_screenBuffer = newScreenBuffer;
_screenBufferSize = newScreenBufferSize;
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16) = width;
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16) = height;
screenDPI = RCT2_ADDRESS(RCT2_ADDRESS_SCREEN_DPI, rct_drawpixelinfo);
screenDPI->bits = _screenBuffer;
screenDPI->x = 0;
screenDPI->y = 0;
screenDPI->width = width;
screenDPI->height = height;
screenDPI->pitch = _surface->pitch - _surface->w;
RCT2_GLOBAL(0x009ABDF0, uint8) = 6;
RCT2_GLOBAL(0x009ABDF1, uint8) = 3;
RCT2_GLOBAL(0x009ABDF2, uint8) = 1;
RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_WIDTH, sint16) = 64;
RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_HEIGHT, sint16) = 8;
RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_COLUMNS, sint32) = (width >> 6) + 1;
RCT2_GLOBAL(RCT2_ADDRESS_DIRTY_BLOCK_ROWS, sint32) = (height >> 3) + 1;
RCT2_CALLPROC_EBPSAFE(0x0066B905); // resize_gui()
gfx_invalidate_screen();
}
开发者ID:ZedThree,项目名称:OpenRCT2,代码行数:52,代码来源:osinterface.c
示例20: window_player_overview_invalidate
void window_player_overview_invalidate(rct_window *w)
{
if (window_player_page_widgets[w->page] != w->widgets) {
w->widgets = window_player_page_widgets[w->page];
window_init_scroll_widgets(w);
}
colour_scheme_update(w);
w->pressed_widgets &= ~(WIDX_TAB_1);
w->pressed_widgets &= ~(WIDX_TAB_2);
w->pressed_widgets |= 1ULL << (w->page + WIDX_TAB_1);
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = w->error.var_480; // set title caption to player name
w->widgets[WIDX_BACKGROUND].right = w->width - 1;
w->widgets[WIDX_BACKGROUND].bottom = w->height - 1;
w->widgets[WIDX_PAGE_BACKGROUND].right =w->width - 1;
w->widgets[WIDX_PAGE_BACKGROUND].bottom = w->height - 1;
w->widgets[WIDX_TITLE].right = w->width - 2;
w->widgets[WIDX_CLOSE].left = w->width - 13;
w->widgets[WIDX_CLOSE].right = w->width - 3;
w->widgets[WIDX_LOCATE].right = w->width - 2;
w->widgets[WIDX_LOCATE].left = w->width - 25;
w->widgets[WIDX_KICK].right = w->width - 2;
w->widgets[WIDX_KICK].left = w->width - 25;
w->widgets[WIDX_VIEWPORT].right = w->width - 26;
w->widgets[WIDX_VIEWPORT].bottom = w->height - 14;
int groupDropdownWidth = w->widgets[WIDX_GROUP].right - w->widgets[WIDX_GROUP].left;
w->widgets[WIDX_GROUP].left = (w->width - groupDropdownWidth) / 2;
w->widgets[WIDX_GROUP].right = w->widgets[WIDX_GROUP].left + groupDropdownWidth;
w->widgets[WIDX_GROUP_DROPDOWN].left = w->widgets[WIDX_GROUP].right - 10;
w->widgets[WIDX_GROUP_DROPDOWN].right = w->widgets[WIDX_GROUP].right;
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_2);
rct_viewport *viewport = w->viewport;
if (viewport != NULL) {
rct_widget *viewportWidget = &window_player_overview_widgets[WIDX_VIEWPORT];
viewport->x = w->x + viewportWidget->left;
viewport->y = w->y + viewportWidget->top;
viewport->width = viewportWidget->right - viewportWidget->left;
viewport->height = viewportWidget->bottom - viewportWidget->top;
viewport->view_width = viewport->width << viewport->zoom;
viewport->view_height = viewport->height << viewport->zoom;
}
}
开发者ID:1337Noob1337,项目名称:OpenRCT2,代码行数:49,代码来源:player.c
注:本文中的RCT2_GLOBAL函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论