Debian Codegraph @

Descent3/hotspotmap.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/main/hotspotmap.h $
21 * $Revision: 10 $
22 * $Date: 4/17/99 6:15p $
23 * $Author: Samir $
24 *
25 * Hotspot stuff for TelCom
26 *
27 * $Log: /DescentIII/main/hotspotmap.h $
28 *
29 * 10 4/17/99 6:15p Samir
30 * replaced gr.h with grdefs.h and fixed resulting compile bugs.
31 *
32 * 9 3/23/98 2:18p Jeff
33 * Moved structures from telcom.h to here to make less dependent
34 *
35 * 8 3/23/98 9:55a Jeff
36 * Made changes to remove old telcom
37 *
38 * 7 3/18/98 8:00p Jeff
39 * Added some functionality for text and using the monitor borders
40 * correctly in the new Telcom
41 *
42 * 6 3/12/98 3:56p Jeff
43 * Added header comments to file
44 *
45 * $NoKeywords: $
46 */
47
48 #ifndef __HOTSPOTMAP_H_
49 #define __HOTSPOTMAP_H_
50
51 #include <filesystem>
52 #include "grdefs.h"
53
54 // for the next two defines this is how they work when converting the alpha values into hotspots/windows
55 // 0 to MAX_HOTSPOTS-1 = HotSpot (button)
56 // MAX_HOTSPOTS to 255 = Window Display
57 // The NO_ALPHA value is which value (0-255) means it's neither HotSpot or Window
58 #define MAX_HOTSPOTS 128
59 #define NO_ALPHA 255
60 #define WRITEABLE_ALPHA 254
61 #define MAX_MAP_WIDTH 640 // Max hotspot map width
62 #define MAX_MAP_HEIGHT 480 // Max hotspot map height
63 #define TELCOM_MAX_ALPHA 130
64
65 // structure for a hotspot scanline
66 struct scanline {
67 int start, end;
68 };
69
70 // structure for 1 hotspot
71 struct hotspot {
72 int starting_y;
73 int scanlines;
74 scanline *x;
75 };
76
77 // structure for all hotspots
78 struct hotspotmap_t {
79 char num_of_hotspots;
80 hotspot *hs;
81 };
82
83 // structure for 1 window
84 struct window_box {
85 int x, y; // leftmost x, topmost y
86 int width, height;
87
88 int l_start_x, l_end_x, r_start_x, r_end_x, t_top_y, t_bottom_y, b_top_y, b_bottom_y;
89 bool on_left, on_top; // used for creating window
90 char *lt, *rt, *lb, *rb; // used for holding the transparent information of the corners
91 int lt_bmp, rt_bmp, lb_bmp, rb_bmp;
92 };
93
94 // structure for all the windows
95 struct windowmap_t {
96 int num_of_windows;
97 window_box *wm;
98 };
99
100 // Loads a tga or ogf file into a bitmap...returns handle to bm or -1 on error, and fills in the alphamap
101 int menutga_alloc_file(const char *name, char *hsmap[], int *w, int *h);
102 // Given a filename and a HotSpotMap structure, it saves it to disk (.HSM)
103 void menutga_SaveHotSpotMap(const std::filesystem::path &filename, hotspotmap_t *hsmap, windowmap_t *wndmap);
104 // Given a filename and a HotSpotMap structure, it loads the hotspot map (.HSM)
105 void menutga_LoadHotSpotMap(int back_bmp, const char *filename, hotspotmap_t *hsmap, windowmap_t *wndmap);
106 // This function (given a filename) loads a TGA file, extracts a hotspot map, and saves the hotspot map
107 bool menutga_ConvertTGAtoHSM(const char *filename);
108
109 void ExportHotSpot(const char *filename, hotspotmap_t *hsmap); // Exports a hotspotmap to an ASCII file, nice and readable
110 void DisplayHotSpots(hotspotmap_t *hsmap,
111 windowmap_t *wndmap); // Displays the hotspots of the given hotspot map to the screen (in blue)
112 void FreeHotSpotMapInternals(hotspotmap_t *hsmap); // Deletes allocated memory within a hotspotmap struct
113 uint16_t menutga_translate_pixel(int pixel, char *alpha_value);
114
115 #endif