mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-23 06:44:38 +01:00
Merge pull request #3727 from zsilencer/integrate
Integrate scenery paint values
This commit is contained in:
@@ -25,6 +25,20 @@
|
||||
#include "../../world/map.h"
|
||||
#include "../../world/scenery.h"
|
||||
|
||||
static const rct_xy16 offsets[] = {
|
||||
{ 3, 3 },
|
||||
{ 3, 17 },
|
||||
{ 17, 3 },
|
||||
{ 3, 3 }
|
||||
};
|
||||
|
||||
static const rct_xy16 lengths[] = {
|
||||
{ 12, 26 },
|
||||
{ 26, 12 },
|
||||
{ 12, 26 },
|
||||
{ 26, 12 }
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006DFF47
|
||||
@@ -58,10 +72,10 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) {
|
||||
if (entry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE) {
|
||||
if (entry->small_scenery.flags & SMALL_SCENERY_FLAG24) {
|
||||
// 6DFFE3:
|
||||
boxoffset.x = RCT2_ADDRESS(0x009A3E7C, uint16)[direction * 4];
|
||||
boxoffset.y = RCT2_ADDRESS(0x009A3E7E, uint16)[direction * 4];
|
||||
boxlength.x = RCT2_ADDRESS(0x009A3E8C, uint16)[direction * 4];
|
||||
boxlength.y = RCT2_ADDRESS(0x009A3E8E, uint16)[direction * 4];
|
||||
boxoffset.x = offsets[direction].x;
|
||||
boxoffset.y = offsets[direction].y;
|
||||
boxlength.x = lengths[direction].x;
|
||||
boxlength.y = lengths[direction].y;
|
||||
x_offset = 3;
|
||||
y_offset = 3;
|
||||
} else {
|
||||
@@ -79,16 +93,18 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) {
|
||||
boxlength.y = 30;
|
||||
}
|
||||
}
|
||||
boxoffset.x = x_offset;
|
||||
boxoffset.y = y_offset;
|
||||
}
|
||||
} else {
|
||||
// 6DFFC2:
|
||||
uint32 ecx = ((mapElement->type >> 6) + get_current_rotation()) & 3;
|
||||
x_offset = RCT2_ADDRESS(0x009A3E74, sint8)[ecx * 2];
|
||||
y_offset = RCT2_ADDRESS(0x009A3E75, sint8)[ecx * 2];
|
||||
x_offset = ScenerySubTileOffsets[ecx].x;
|
||||
y_offset = ScenerySubTileOffsets[ecx].y;
|
||||
boxoffset.x = x_offset;
|
||||
boxoffset.y = y_offset;
|
||||
}
|
||||
// 6E0074:
|
||||
boxoffset.x = x_offset;
|
||||
boxoffset.y = y_offset;
|
||||
// 6E007F:
|
||||
boxlength.z = entry->small_scenery.height - 4;
|
||||
if (boxlength.z < 0) {
|
||||
boxlength.z = -128;
|
||||
|
||||
@@ -154,6 +154,31 @@ void scenery_multiple_sign_paint_line(const utf8 *str, rct_large_scenery_text *t
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct boundbox {
|
||||
rct_xy16 offset;
|
||||
rct_xy16 length;
|
||||
} boundbox;
|
||||
|
||||
static const boundbox s98E3C4[] = {
|
||||
{ 3, 3, 26, 26 },
|
||||
{ 17, 17, 12, 12 },
|
||||
{ 17, 3, 12, 12 },
|
||||
{ 17, 3, 12, 26 },
|
||||
{ 3, 3, 12, 12 },
|
||||
{ 3, 3, 26, 26 },
|
||||
{ 3, 3, 28, 12 },
|
||||
{ 3, 3, 26, 26 },
|
||||
{ 3, 17, 12, 12 },
|
||||
{ 3, 17, 26, 12 },
|
||||
{ 3, 3, 26, 26 },
|
||||
{ 3, 3, 26, 26 },
|
||||
{ 3, 3, 12, 28 },
|
||||
{ 3, 3, 26, 26 },
|
||||
{ 3, 3, 26, 26 },
|
||||
{ 3, 3, 26, 26 },
|
||||
{ 1, 1, 30, 30 }
|
||||
};
|
||||
|
||||
/*
|
||||
*
|
||||
* rct2: 0x006B7F0C
|
||||
@@ -193,14 +218,14 @@ void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *map
|
||||
int esi = 16;
|
||||
if (edi & 0xF00) {
|
||||
edi &= 0xF000;
|
||||
edi = (edi << direction) | (edi >> (16 - direction)); // rol
|
||||
edi = rol16(edi, direction);
|
||||
esi = (edi & 0xF) | (edi >> 12);
|
||||
}
|
||||
boxoffset.x = RCT2_ADDRESS(0x0098E3C4, uint16)[esi * 4];
|
||||
boxoffset.y = RCT2_ADDRESS(0x0098E3C6, uint16)[esi * 4];
|
||||
boxoffset.x = s98E3C4[esi].offset.x;
|
||||
boxoffset.y = s98E3C4[esi].offset.y;
|
||||
boxoffset.z = height;
|
||||
boxlength.x = RCT2_ADDRESS(0x0098E3C8, uint16)[esi * 4];
|
||||
boxlength.y = RCT2_ADDRESS(0x0098E3CA, uint16)[esi * 4];
|
||||
boxlength.x = s98E3C4[esi].length.x;
|
||||
boxlength.y = s98E3C4[esi].length.y;
|
||||
boxlength.z = ah;
|
||||
sub_98197C(image_id, 0, 0, boxlength.x, boxlength.y, ah, height, boxoffset.x, boxoffset.y, boxoffset.z, get_current_rotation());
|
||||
if (entry->large_scenery.var_11 == 0xFF || direction == 1 || direction == 2) {
|
||||
@@ -250,9 +275,9 @@ void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *map
|
||||
const utf8 *fitStrPtr = fitStr;
|
||||
strncpy(fitStr, scenery_multiple_sign_fit_text(signString, text, true), sizeof(fitStr) - 1);
|
||||
int height = scenery_multiple_sign_text_height(fitStr, text);
|
||||
utf8 str[5] = {0};
|
||||
uint32 codepoint;
|
||||
while ((codepoint = utf8_get_next(fitStrPtr, &fitStrPtr)) != 0) {
|
||||
utf8 str[5] = {0};
|
||||
utf8_write_codepoint(str, codepoint);
|
||||
scenery_multiple_sign_paint_line(str, entry->large_scenery.text, entry->large_scenery.text_image, textColour, direction, y_offset - height);
|
||||
y_offset += scenery_multiple_sign_get_glyph(text, codepoint)->height * 2;
|
||||
|
||||
@@ -2959,8 +2959,8 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi
|
||||
x2 += 16;
|
||||
y2 += 16;
|
||||
}else{
|
||||
x2 += RCT2_ADDRESS(0x009A3E74, uint8)[(quadrant & 3) * 2] - 1;
|
||||
y2 += RCT2_ADDRESS(0x009A3E75, uint8)[(quadrant & 3) * 2] - 1;
|
||||
x2 += ScenerySubTileOffsets[quadrant & 3].x - 1;
|
||||
y2 += ScenerySubTileOffsets[quadrant & 3].y - 1;
|
||||
}
|
||||
int base_height2 = map_element_height(x2, y2);
|
||||
if(base_height2 & 0xFFFF0000){
|
||||
|
||||
@@ -60,6 +60,14 @@ sint16 gSceneryCtrlPressZ;
|
||||
|
||||
uint8 gSceneryGroundFlags;
|
||||
|
||||
// rct2: 0x009A3E74
|
||||
const rct_xy8 ScenerySubTileOffsets[] = {
|
||||
{ 7, 7 },
|
||||
{ 7, 23 },
|
||||
{ 23, 23 },
|
||||
{ 23, 7 }
|
||||
};
|
||||
|
||||
void scenery_increase_age(int x, int y, rct_map_element *mapElement);
|
||||
|
||||
void scenery_update_tile(int x, int y)
|
||||
|
||||
@@ -223,6 +223,8 @@ extern sint16 gSceneryCtrlPressZ;
|
||||
|
||||
extern uint8 gSceneryGroundFlags;
|
||||
|
||||
extern const rct_xy8 ScenerySubTileOffsets[];
|
||||
|
||||
extern sint16 window_scenery_tab_entries[20][SCENERY_ENTRIES_BY_TAB + 1];
|
||||
|
||||
void init_scenery();
|
||||
|
||||
Reference in New Issue
Block a user