| 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/BriefingParse.h $ |
| 21 | * $Revision: 7 $ |
| 22 | * $Date: 4/17/99 6:15p $ |
| 23 | * $Author: Samir $ |
| 24 | * |
| 25 | * |
| 26 | * |
| 27 | * $Log: /DescentIII/main/BriefingParse.h $ |
| 28 | * |
| 29 | * 7 4/17/99 6:15p Samir |
| 30 | * replaced gr.h with grdefs.h and fixed resulting compile bugs. |
| 31 | * |
| 32 | * 6 4/16/99 1:51a Jeff |
| 33 | * include linux fix for stricmp |
| 34 | * |
| 35 | * 5 4/14/99 3:56a Jeff |
| 36 | * fixed case mismatch in #includes |
| 37 | * |
| 38 | * 4 1/04/99 12:32p Jeff |
| 39 | * added support for mission flag parsing |
| 40 | * |
| 41 | * 3 9/11/98 6:06p Jeff |
| 42 | * Briefing Editor completed |
| 43 | * |
| 44 | * 2 9/09/98 7:02p Jeff |
| 45 | * Initial Creation |
| 46 | * |
| 47 | * $NoKeywords: $ |
| 48 | */ |
| 49 | |
| 50 | #ifndef __BRIEFPARSE_H_ |
| 51 | #define __BRIEFPARSE_H_ |
| 52 | |
| 53 | #if defined(POSIX) |
| 54 | #include "linux_fix.h" //for stricmp |
| 55 | #endif |
| 56 | |
| 57 | #include "TelComEfxStructs.h" |
| 58 | #include "grdefs.h" |
| 59 | |
| 60 | // Return codes of ParseBriefing |
| 61 | #define PBERR_FILENOTEXIST -1 |
| 62 | #define PBERR_NOERR 0 |
| 63 | |
| 64 | struct tBriefParseCallbacks { |
| 65 | void (*AddTextEffect)(TCTEXTDESC* desc, char *text, char *description, int id); |
| 66 | void (*AddBmpEffect)(TCBMPDESC* desc, char *description); |
| 67 | void (*AddMovieEffect)(TCMOVIEDESC* desc, char *description); |
| 68 | void (*AddBkgEffect)(TCBKGDESC* desc, char *description); |
| 69 | void (*AddPolyEffect)(TCPOLYDESC* desc, char *description); |
| 70 | void (*AddSoundEffect)(TCSNDDESC* desc, char *description); |
| 71 | void (*AddButtonEffect)(TCBUTTONDESC* desc, char *description, int id); |
| 72 | void (*StartScreen)(int screen_num, char *description, char *layout, uint32_t mask_set, uint32_t mask_unset); |
| 73 | void (*EndScreen)(); |
| 74 | bool (*LoopCallback)(); |
| 75 | void (*SetTitle)(char *title); |
| 76 | void (*SetStatic)(float amount); |
| 77 | void (*SetGlitch)(float amount); |
| 78 | void (*AddVoice)(char *filename, int flags,char *description); |
| 79 | }; |
| 80 | |
| 81 | struct tTextBufferDesc { |
| 82 | TCTEXTDESC textdesc; |
| 83 | int text_id; |
| 84 | int teffect; |
| 85 | char description[128]; |
| 86 | }; |
| 87 | |
| 88 | class CBriefParse { |
| 89 | public: |
| 90 | CBriefParse(); |
| 91 | ~CBriefParse(); |
| 92 | void SetCallbacks(tBriefParseCallbacks *cb); |
| 93 | int ParseBriefing(const char *filename); |
| 94 | |
| 95 | private: |
| 96 | void (*AddTextEffect)(TCTEXTDESC* desc, char *text, char *description, int id); |
| 97 | void (*AddBmpEffect)(TCBMPDESC* desc, char *description); |
| 98 | void (*AddMovieEffect)(TCMOVIEDESC* desc, char *description); |
| 99 | void (*AddBkgEffect)(TCBKGDESC* desc, char *description); |
| 100 | void (*AddPolyEffect)(TCPOLYDESC* desc, char *description); |
| 101 | void (*AddSoundEffect)(TCSNDDESC* desc, char *description); |
| 102 | void (*AddButtonEffect)(TCBUTTONDESC* desc, char *description, int id); |
| 103 | void (*StartScreen)(int screen_num, char *desc, char *layout, uint32_t mask_set, uint32_t mask_unset); |
| 104 | void (*EndScreen)(); |
| 105 | bool (*LoopCallback)(); |
| 106 | void (*SetTitle)(char *title); |
| 107 | void (*SetStatic)(float amount); |
| 108 | void (*SetGlitch)(float amount); |
| 109 | void (*AddVoice)(char *filename, int flags, char *description); |
| 110 | |
| 111 | void ParseError(const char *msg, const char *p = NULL); |
| 112 | const char *ParseComma(const char *p); |
| 113 | const char *ParseFloat(const char *p, float *f); |
| 114 | const char *ParseInt(const char *p, int *i); |
| 115 | const char *ParseString(const char *p, char *buf, int bufsize); |
| 116 | const char *ParseToken(const char *p, char *buf, int bufsize); |
| 117 | const char *SkipWhite(const char *p); |
| 118 | const char *ParseKeyword(const char *p, int *keyword_id); |
| 119 | bool ParseButtonEffect(const char *p); |
| 120 | bool ParseTextEffect(const char *p, tTextBufferDesc *tbd); |
| 121 | |
| 122 | int linenum; |
| 123 | bool parse_error; |
| 124 | }; |
| 125 | |
| 126 | #endif |