| 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/multi_dll_mgr.h $ |
| 21 | * $Revision: 19 $ |
| 22 | * $Date: 4/25/99 5:02p $ |
| 23 | * $Author: Kevin $ |
| 24 | * |
| 25 | * Multi player DLL interface manager |
| 26 | * |
| 27 | * $Log: /DescentIII/main/multi_dll_mgr.h $ |
| 28 | * |
| 29 | * 19 4/25/99 5:02p Kevin |
| 30 | * Bunches of multiplayer UI improvements |
| 31 | * |
| 32 | * 18 4/08/99 3:41p Kevin |
| 33 | * Added some stuff for the scoring API. Not functional yet. |
| 34 | * |
| 35 | * 17 1/12/99 2:55p Jeff |
| 36 | * added/finished the waiting for player's to join dialog |
| 37 | * |
| 38 | * 16 12/08/98 3:28p Jeff |
| 39 | * created and exported UI Checkbox wrappers |
| 40 | * |
| 41 | * 15 11/19/98 5:56p Jeff |
| 42 | * created Slider wrappers |
| 43 | * |
| 44 | * 14 10/29/98 7:00p Jeff |
| 45 | * create some new UI function wrappers |
| 46 | * |
| 47 | * 13 9/15/98 12:42p Jason |
| 48 | * got dedicated server actually working |
| 49 | * |
| 50 | * 12 8/31/98 10:14a Kevin |
| 51 | * Misc. multi-UI fixes |
| 52 | * |
| 53 | * 11 8/27/98 5:03p Kevin |
| 54 | * Prettied up multiplayer screens and fixed some bugs. |
| 55 | * |
| 56 | * 10 8/24/98 10:55a Kevin |
| 57 | * new directplay stuff |
| 58 | * |
| 59 | * 9 8/07/98 12:40p Jeff |
| 60 | * added some functions |
| 61 | * |
| 62 | * 8 7/20/98 2:34p Kevin |
| 63 | * Re-wrote the DLL wrapper, to allow for better expandability |
| 64 | * |
| 65 | * 6 6/24/98 6:40p Kevin |
| 66 | * Added help to main dll menu |
| 67 | * |
| 68 | * 5 6/24/98 3:24p Kevin |
| 69 | * Updated PXO screens with chat, etc. |
| 70 | * |
| 71 | * 4 6/18/98 4:49p Kevin |
| 72 | * Updated multiplayer menus |
| 73 | * |
| 74 | * 3 6/01/98 10:09a Kevin |
| 75 | * Added DLL connection interface and auto update DLL |
| 76 | * |
| 77 | * 2 5/18/98 12:16p Kevin |
| 78 | * Initial version |
| 79 | * |
| 80 | * 1 5/18/98 12:07p Kevin |
| 81 | * |
| 82 | * $NoKeywords: $ |
| 83 | */ |
| 84 | |
| 85 | #ifndef _multi_dll_header |
| 86 | #define _multi_dll_header |
| 87 | |
| 88 | #define MT_EVT_LOGIN 1 |
| 89 | #define MT_EVT_FIRST_FRAME 2 |
| 90 | #define MT_EVT_FRAME 3 |
| 91 | #define MT_EVT_GAME_OVER 4 |
| 92 | #define MT_EVT_GET_HELP 5 |
| 93 | #define MT_AUTO_LOGIN 6 |
| 94 | #define MT_AUTO_START 7 // A dedicated server is starting this DLL |
| 95 | |
| 96 | struct multi_api { |
| 97 | int *objs; |
| 98 | int *rooms; |
| 99 | int *terrain; |
| 100 | int *players; |
| 101 | int *netgame; |
| 102 | int *netplayers; |
| 103 | int *ships; |
| 104 | int *fp[200]; // function pointers |
| 105 | int *vp[200]; // variable pointers |
| 106 | }; |
| 107 | |
| 108 | #define MAX_AUTO_LOGIN_STUFF_LEN 50 |
| 109 | extern char Auto_login_name[MAX_AUTO_LOGIN_STUFF_LEN]; |
| 110 | extern char Auto_login_pass[MAX_AUTO_LOGIN_STUFF_LEN]; |
| 111 | extern char Auto_login_addr[MAX_AUTO_LOGIN_STUFF_LEN]; |
| 112 | extern char Auto_login_port[MAX_AUTO_LOGIN_STUFF_LEN]; |
| 113 | |
| 114 | void GetMultiAPI(multi_api *api); |
| 115 | void FreeMultiDLL(); |
| 116 | int LoadMultiDLL(const char *name); |
| 117 | void CallMultiDLL(int eventnum); |
| 118 | |
| 119 | void SetUITextItemText(UITextItem *uit, char *newtext, uint32_t color); |
| 120 | void *NewUIWindowCreate(int x, int y, int w, int h, int flags); |
| 121 | void NewUIWindowDestroy(NewUIWindow *deswin); |
| 122 | void NewUIWindowOpen(NewUIWindow *deswin); |
| 123 | void NewUIWindowClose(NewUIWindow *deswin); |
| 124 | void *TextCreate(UIWindow *parentwin, UITextItem *textitem, int x, int y, int flags); |
| 125 | void TextSetTitle(UIText *text, UITextItem *textitem); |
| 126 | void *EditCreate(UIWindow *parentwin, int id, int x, int y, int w, int h, int flags); |
| 127 | void *ButtonCreate(UIWindow *parentwin, int id, UITextItem *titleitem, int x, int y, int w, int h, int flags); |
| 128 | void *ListCreate(UIWindow *parentwin, int id, int x, int y, int w, int h, int flags); |
| 129 | void ListRemoveAll(UIListBox *item); |
| 130 | void ListAddItem(UIListBox *item, UITextItem *uitext); |
| 131 | void ListRemoveItem(UIListBox *item, UITextItem *txtitem); |
| 132 | void ListSelectItem(UIListBox *item, UITextItem *txtitem); |
| 133 | const char *ListGetItem(UIListBox *item, int index); |
| 134 | int ListGetSelectedIndex(UIListBox *item); |
| 135 | void ListSetSelectedIndex(UIListBox *item, int index); |
| 136 | void EditSetText(NewUIEdit *item, const char *buff); |
| 137 | void EditGetText(NewUIEdit *item, char *buff, int len); |
| 138 | void DatabaseRead(const char *label, char *entry, int *entrylen); |
| 139 | void DatabaseWrite(const char *label, const char *entry, int entrylen); |
| 140 | void DescentDefer(void); |
| 141 | void *NewUIGameWindowCreate(int x, int y, int w, int h, int flags = UIF_PROCESS_ALL); |
| 142 | void NewUIGameWindowDestroy(NewUIGameWindow *item); |
| 143 | void NewUIGameWindowOpen(NewUIGameWindow *item); |
| 144 | void NewUIGameWindowClose(NewUIGameWindow *item); |
| 145 | void *HotSpotCreate(UIWindow *parentwin, int id, int key, UIItem *txtitemoff, UIItem *txtitemon, int x, int y, int w, |
| 146 | int h, int flags); |
| 147 | void HotSpotSetStates(UIHotspot *hs, UIItem *texton, UIItem *textoff); |
| 148 | int PollUI(void); |
| 149 | void RemoveUITextItem(void *item); |
| 150 | void *CreateNewUITextItem(const char *newtext, uint32_t color, int font = -1); |
| 151 | void RemoveUIBmpItem(void *item); |
| 152 | void *CreateNewUIBmpItem(int handle, uint8_t alpha); |
| 153 | void CloseSplashScreen(void); |
| 154 | void CreateSplashScreen(const char *msg, int usecancel); |
| 155 | void *UIConsoleGadgetCreate(UIWindow *parentid, int id, int x, int y, int font, int cols, int rows, int flags); |
| 156 | void UIConsoleGadgetputs(UIConsoleGadget *item, const char *str); |
| 157 | void NewUIWindowSetFocusOnEditGadget(UIEdit *item, UIWindow *parent); |
| 158 | void *OldListCreate(UIWindow *parentitem, int id, int x, int y, int w, int h, int flags); |
| 159 | void OldListRemoveAll(UIListBox *item); |
| 160 | void OldListAddItem(UIListBox *item, UITextItem *uitext); |
| 161 | void OldListRemoveItem(UIListBox *item, UITextItem *txtitem); |
| 162 | void OldListSelectItem(UIListBox *item, UITextItem *txtitem); |
| 163 | void *OldEditCreate(UIWindow *parentitem, int id, int x, int y, int w, int h, int flags); |
| 164 | void OldEditGetText(UIEdit *item, char *buff, int len); |
| 165 | void OldEditSetText(UIEdit *item, const char *newtext); |
| 166 | const char *OldListGetItem(UIListBox *item, int index); |
| 167 | int OldListGetSelectedIndex(UIListBox *item); |
| 168 | void ToggleUICallback(int state); |
| 169 | void SetOldEditBufferLen(UIEdit *item, int len); |
| 170 | void NewUIWindowLoadBackgroundImage(NewUIWindow *item, const char *image_name); |
| 171 | void DeleteUIItem(void *delitem); |
| 172 | void DatabaseReadInt(const char *label, int *val); |
| 173 | void DatabaseWriteInt(const char *label, int val); |
| 174 | void GadgetDestroy(UIGadget *item); |
| 175 | int GetUIItemWidth(void *item); |
| 176 | int GetUIItemHeight(void *item); |
| 177 | void *SliderCreate(UIWindow *parent, int id, int x, int y, int flags = 0); |
| 178 | void SliderSetRange(UISlider *slider, int range); |
| 179 | int SliderGetRange(UISlider *slider); |
| 180 | void SliderSetPos(UISlider *slider, int pos); |
| 181 | int SliderGetPos(UISlider *slider); |
| 182 | void SliderSetSelectChangeCallback(UISlider *slider, void (*fn)(int)); |
| 183 | void SliderSetSelectChangeCallbackWData(UISlider *slider, void (*fn)(int, void *), void *ptr); |
| 184 | void *CheckBoxCreate(UIWindow *parent, int id, UIItem *title, int x, int y, int w, int h, int flags); |
| 185 | void CheckBoxSetCheck(UICheckBox *cb, bool state); |
| 186 | bool CheckBoxIsChecked(UICheckBox *cb); |
| 187 | void GetUIItemPosition(UIObject *item, int *x, int *y, int *w, int *h); |
| 188 | |
| 189 | void ScoreAPIFrameInterval(); |
| 190 | void ScoreAPIGameOver(); |
| 191 | void ScoreAPIPlayerJoin(int playernum); |
| 192 | void ScoreAPIPlayerLeft(int playernum); |
| 193 | void ScoreAPIPlayerEntered(int playernum); |
| 194 | void ScoreAPIPlayerKilled(int killer, int killed); |
| 195 | |
| 196 | #endif |