| 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_cxx . . $ `Descent3/hotspotmap.h:49:9`! |
| 50 | |
| 51 | #include <filesystem> |
| 52 | #include "grdefs.h"cxx . . $ `<file>/lib/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_HOTSPOTScxx . . $ `Descent3/hotspotmap.h:58:9`! 128 |
| 59 | #define NO_ALPHAcxx . . $ `Descent3/hotspotmap.h:59:9`! 255 |
| 60 | #define WRITEABLE_ALPHAcxx . . $ `Descent3/hotspotmap.h:60:9`! 254 |
| 61 | #define MAX_MAP_WIDTHcxx . . $ `Descent3/hotspotmap.h:61:9`! 640 // Max hotspot map width |
| 62 | #define MAX_MAP_HEIGHTcxx . . $ `Descent3/hotspotmap.h:62:9`! 480 // Max hotspot map height |
| 63 | #define TELCOM_MAX_ALPHAcxx . . $ `Descent3/hotspotmap.h:63:9`! 130 |
| 64 | |
| 65 | // structure for a hotspot scanline |
| 66 | struct scanlinecxx . . $ scanline# { |
| 67 | int startcxx . . $ scanline#start., endcxx . . $ scanline#end.; |
| 68 | }; |
| 69 | |
| 70 | // structure for 1 hotspot |
| 71 | struct hotspotcxx . . $ hotspot# { |
| 72 | int starting_ycxx . . $ hotspot#starting_y.; |
| 73 | int scanlinescxx . . $ hotspot#scanlines.; |
| 74 | scanlinecxx . . $ scanline# *xcxx . . $ hotspot#x.; |
| 75 | }; |
| 76 | |
| 77 | // structure for all hotspots |
| 78 | struct hotspotmap_tcxx . . $ hotspotmap_t# { |
| 79 | char num_of_hotspotscxx . . $ hotspotmap_t#num_of_hotspots.; |
| 80 | hotspotcxx . . $ hotspot# *hscxx . . $ hotspotmap_t#hs.; |
| 81 | }; |
| 82 | |
| 83 | // structure for 1 window |
| 84 | struct window_boxcxx . . $ window_box# { |
| 85 | int xcxx . . $ window_box#x., ycxx . . $ window_box#y.; // leftmost x, topmost y |
| 86 | int widthcxx . . $ window_box#width., heightcxx . . $ window_box#height.; |
| 87 | |
| 88 | int l_start_xcxx . . $ window_box#l_start_x., l_end_xcxx . . $ window_box#l_end_x., r_start_xcxx . . $ window_box#r_start_x., r_end_xcxx . . $ window_box#r_end_x., t_top_ycxx . . $ window_box#t_top_y., t_bottom_ycxx . . $ window_box#t_bottom_y., b_top_ycxx . . $ window_box#b_top_y., b_bottom_ycxx . . $ window_box#b_bottom_y.; |
| 89 | bool on_leftcxx . . $ window_box#on_left., on_topcxx . . $ window_box#on_top.; // used for creating window |
| 90 | char *ltcxx . . $ window_box#lt., *rtcxx . . $ window_box#rt., *lbcxx . . $ window_box#lb., *rbcxx . . $ window_box#rb.; // used for holding the transparent information of the corners |
| 91 | int lt_bmpcxx . . $ window_box#lt_bmp., rt_bmpcxx . . $ window_box#rt_bmp., lb_bmpcxx . . $ window_box#lb_bmp., rb_bmpcxx . . $ window_box#rb_bmp.; |
| 92 | }; |
| 93 | |
| 94 | // structure for all the windows |
| 95 | struct windowmap_tcxx . . $ windowmap_t# { |
| 96 | int num_of_windowscxx . . $ windowmap_t#num_of_windows.; |
| 97 | window_boxcxx . . $ window_box# *wmcxx . . $ windowmap_t#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_filecxx . . $ menutga_alloc_file(aa5a3b94b7175785).(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_SaveHotSpotMapcxx . . $ menutga_SaveHotSpotMap(144612ff950e0346).(const stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# &filename, hotspotmap_tcxx . . $ hotspotmap_t# *hsmap, windowmap_tcxx . . $ windowmap_t# *wndmap); |
| 104 | // Given a filename and a HotSpotMap structure, it loads the hotspot map (.HSM) |
| 105 | void menutga_LoadHotSpotMapcxx . . $ menutga_LoadHotSpotMap(b6655629de763852).(int back_bmp, const char *filename, hotspotmap_tcxx . . $ hotspotmap_t# *hsmap, windowmap_tcxx . . $ 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_ConvertTGAtoHSMcxx . . $ menutga_ConvertTGAtoHSM(c5f7da30cbc0f4e9).(const char *filename); |
| 108 | |
| 109 | void ExportHotSpotcxx . . $ ExportHotSpot(beb635a7fb038926).(const char *filename, hotspotmap_tcxx . . $ hotspotmap_t# *hsmap); // Exports a hotspotmap to an ASCII file, nice and readable |
| 110 | void DisplayHotSpotscxx . . $ DisplayHotSpots(6b739274a49b7b38).(hotspotmap_tcxx . . $ hotspotmap_t# *hsmap, |
| 111 | windowmap_tcxx . . $ windowmap_t# *wndmap); // Displays the hotspots of the given hotspot map to the screen (in blue) |
| 112 | void FreeHotSpotMapInternalscxx . . $ FreeHotSpotMapInternals(40652d961f76803d).(hotspotmap_tcxx . . $ hotspotmap_t# *hsmap); // Deletes allocated memory within a hotspotmap struct |
| 113 | uint16_tcxx . . $ uint16_t# menutga_translate_pixelcxx . . $ menutga_translate_pixel(7e0c9d8322f04898).(int pixel, char *alpha_value); |
| 114 | |
| 115 | #endif |