Add pick_region

This commit is contained in:
Alexander Batalov 2023-09-03 20:12:20 +03:00
parent 8c61b0bd8c
commit 30a3bf9b71
4 changed files with 54 additions and 1 deletions

View File

@ -199,6 +199,13 @@ int inputGetInput()
return -1;
}
// 0x4C8BC8
void get_input_position(int* x, int* y)
{
*x = _input_mx;
*y = _input_my;
}
// 0x4C8BDC
void _process_bk()
{

View File

@ -13,6 +13,7 @@ typedef int(ScreenshotHandler)(int width, int height, unsigned char* buffer, uns
int inputInit(int a1);
void inputExit();
int inputGetInput();
void get_input_position(int* x, int* y);
void _process_bk();
void enqueueInputEvent(int a1);
void inputEventQueueReset();

View File

@ -1,6 +1,10 @@
#include "mapper/map_func.h"
#include "color.h"
#include "game_mouse.h"
#include "input.h"
#include "memory.h"
#include "mouse.h"
#include "proto.h"
#include "svga.h"
#include "window_manager.h"
@ -22,6 +26,46 @@ void copy_proto_lists()
// TODO: Incomplete.
}
// 0x4841C4
void pick_region(Rect* rect)
{
Rect temp;
int x;
int y;
gameMouseSetCursor(MOUSE_CURSOR_PLUS);
gameMouseObjectsHide();
while (1) {
if (inputGetInput() == -2
&& (mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_DOWN) != 0) {
break;
}
}
get_input_position(&x, &y);
temp.left = x;
temp.top = y;
temp.right = x;
temp.bottom = y;
while ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_UP) == 0) {
inputGetInput();
get_input_position(&x, &y);
if (x != temp.right || y != temp.bottom) {
erase_rect(rect);
sort_rect(rect, &temp);
draw_rect(rect, _colorTable[32747]);
}
}
erase_rect(rect);
gameMouseSetCursor(MOUSE_CURSOR_ARROW);
gameMouseObjectsShow();
}
// 0x484294
void sort_rect(Rect* a, Rect* b)
{

View File

@ -7,8 +7,9 @@ namespace fallout {
void setup_map_dirs();
void copy_proto_lists();
void pick_region(Rect* rect);
void sort_rect(Rect* a, Rect* b);
void draw_rect(Rect* rect);
void draw_rect(Rect* rect, unsigned char color);
void erase_rect(Rect* rect);
int toolbar_proto(int type, int id);
bool map_toggle_block_obj_viewing_on();