22#ifndef NUVIE_MISC_U6_MISC_H
23#define NUVIE_MISC_U6_MISC_H
33#include "common/str.h"
34#include "ultima/nuvie/core/nuvie_defs.h"
35#include "common/rect.h"
36#include "graphics/managed_surface.h"
50const char *get_game_tag(
int game_type);
52uint8 get_game_type(
const char *
string);
53nuvie_game_t get_game_type(
const Configuration *config);
57void print_b(DebugLevelType level, uint8 num);
58void print_b16(DebugLevelType level, uint16 num);
59void print_indent(DebugLevelType level, uint8 indent);
60void print_bool(DebugLevelType level,
bool state,
const char *yes =
"true",
const char *no =
"false");
61void print_flags(DebugLevelType level, uint8 num,
const char *f[8]);
63NuvieDir get_nuvie_dir_code(uint8 original_dir_code);
64sint8 get_original_dir_code(NuvieDir nuvie_dir_code);
65NuvieDir get_direction_code(sint16 rel_x, sint16 rel_y);
66NuvieDir get_reverse_direction(NuvieDir dir);
67void get_relative_dir(NuvieDir dir, sint16 *rel_x, sint16 *rel_y);
68const char *get_direction_name(NuvieDir dir);
69const char *get_direction_name(sint16 rel_x, sint16 rel_y);
70int str_bsearch(
const char *
const str[],
int max,
const char *value);
74inline bool line_in_rect(uint16 x1, uint16 y1, uint16 x2, uint16 y2,
const Common::Rect *rect) {
75 uint16 rx2 = rect->right, ry2 = rect->bottom;
76 return (((y1 >= rect->top && y1 <= ry2 && x1 <= rx2 && x2 >= rect->left)
77 || (x1 >= rect->left && x1 <= rx2 && y1 <= ry2 && y2 >= rect->top)));
84inline uint32 divide_time(uint32 this_time, uint32 &last_time, uint32 *passed_time =
nullptr) {
85 uint32 ms_passed = (this_time - last_time) > 0 ? (this_time - last_time) : 1;
86 uint32 fraction = 1000 / ms_passed;
87 last_time = this_time;
89 *passed_time = ms_passed;
95void draw_line_8bit(
int sx,
int sy,
int ex,
int ey, uint8 col, uint8 *pixels, uint16 w, uint16 h);
99void *nuvie_realloc(
void *ptr,
size_t size);
103void scale_rect_8bit(
const unsigned char *Source,
unsigned char *Target,
int SrcWidth,
int SrcHeight,
int TgtWidth,
int TgtHeight);
105bool has_file_extension(
const char *filename,
const char *extension);
107bool has_fmtowns_support(
const Configuration *config);
109uint16 wrap_signed_coord(sint16 coord, uint8 level);
110sint8 get_wrapped_rel_dir(sint16 p1, sint16 p2, uint8 level);
Definition: managed_surface.h:51