Add draw_rect
This commit is contained in:
parent
7f920fe13b
commit
84aecfa823
|
@ -1,6 +1,8 @@
|
||||||
#include "mapper/map_func.h"
|
#include "mapper/map_func.h"
|
||||||
|
|
||||||
|
#include "memory.h"
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
|
#include "svga.h"
|
||||||
#include "window_manager.h"
|
#include "window_manager.h"
|
||||||
|
|
||||||
namespace fallout {
|
namespace fallout {
|
||||||
|
@ -20,6 +22,30 @@ void copy_proto_lists()
|
||||||
// TODO: Incomplete.
|
// TODO: Incomplete.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 0x4842D4
|
||||||
|
void draw_rect(Rect* rect, unsigned char color)
|
||||||
|
{
|
||||||
|
int width = rect->right - rect->left;
|
||||||
|
int height = rect->bottom - rect->top;
|
||||||
|
int max_dimension;
|
||||||
|
|
||||||
|
if (height < width) {
|
||||||
|
max_dimension = width;
|
||||||
|
} else {
|
||||||
|
max_dimension = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char* buffer = (unsigned char*)internal_malloc(max_dimension);
|
||||||
|
if (buffer != NULL) {
|
||||||
|
memset(buffer, color, max_dimension);
|
||||||
|
_scr_blit(buffer, width, 1, 0, 0, width, 1, rect->left, rect->top);
|
||||||
|
_scr_blit(buffer, 1, height, 0, 0, 1, height, rect->left, rect->top);
|
||||||
|
_scr_blit(buffer, width, 1, 0, 0, width, 1, rect->left, rect->bottom);
|
||||||
|
_scr_blit(buffer, 1, height, 0, 0, 1, height, rect->right, rect->top);
|
||||||
|
internal_free(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 0x4843A0
|
// 0x4843A0
|
||||||
void erase_rect(Rect* rect)
|
void erase_rect(Rect* rect)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,7 @@ namespace fallout {
|
||||||
|
|
||||||
void setup_map_dirs();
|
void setup_map_dirs();
|
||||||
void copy_proto_lists();
|
void copy_proto_lists();
|
||||||
|
void draw_rect(Rect* rect);
|
||||||
void erase_rect(Rect* rect);
|
void erase_rect(Rect* rect);
|
||||||
int toolbar_proto(int type, int id);
|
int toolbar_proto(int type, int id);
|
||||||
bool map_toggle_block_obj_viewing_on();
|
bool map_toggle_block_obj_viewing_on();
|
||||||
|
|
Loading…
Reference in New Issue