mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-08-30 11:16:59 -04:00
dryad doesn't shoot through wall, demon softlock, end of round for spells
This commit is contained in:
parent
936bafca5a
commit
5901dc8a4b
12 changed files with 93 additions and 40 deletions
|
@ -148,5 +148,7 @@ void put_picture2picture(const word *source,word *target,int xp,int yp);
|
|||
|
||||
void draw_rounded_rectangle(int x, int y, int xs, int ys, int radius,
|
||||
int stroke_color, int fill_color);
|
||||
void greyscale_rectangle_ex(int x, int y, int xs, int ys, uint16_t *screen_address, size_t line_width);
|
||||
void greyscale_rectangle(int x, int y, int xs, int ys);
|
||||
|
||||
#define swap_int(a,b) do {int c=a;a=b;b=c;} while (0);
|
||||
|
|
|
@ -789,3 +789,27 @@ void draw_rounded_rectangle(int x, int y, int xs, int ys, int radius,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void greyscale_rectangle_ex(int x, int y, int xs, int ys, uint16_t *screen_address, size_t line_width) {
|
||||
for (int j = y; j < y + ys; j++) {
|
||||
for (int i = x; i < x + xs; i++) {
|
||||
uint16_t *pixel = screen_address + j * line_width + i;
|
||||
uint16_t color = *pixel;
|
||||
|
||||
// Extract RGB components (5 bits each)
|
||||
int r = (color >> 10) & 0x1F;
|
||||
int g = (color >> 5) & 0x1F;
|
||||
int b = color & 0x1F;
|
||||
|
||||
// Calculate greyscale value (average of RGB)
|
||||
int grey = (r + g + b) / 3;
|
||||
|
||||
// Reconstruct the pixel with the MSB intact
|
||||
*pixel = (color & 0x8000) | (grey << 10) | (grey << 5) | grey;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void greyscale_rectangle(int x, int y, int xs, int ys) {
|
||||
greyscale_rectangle_ex(x,y,xs,ys,GetScreenAdr(),GetScreenPitch());
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ extern "C" {
|
|||
#define MS_EVENT_MOUSE_RRELEASE 16
|
||||
#define MS_EVENT_MOUSE_MPRESS 32
|
||||
#define MS_EVENT_MOUSE_MRELEASE 64
|
||||
#define MS_EVENT_MOUSE_LDBLCLK 128
|
||||
|
||||
|
||||
typedef struct ms_event
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue