1 /*
2 
3 Copyright (C) 2015-2018 Night Dive Studios, LLC.
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 */
19 #ifndef __MUSICAI_H
20 #define __MUSICAI_H
21 
22 /*
23  * $Source: r:/prj/cit/src/inc/RCS/musicai.h $
24  * $Revision: 1.28 $
25  * $Author: dc $
26  * $Date: 1994/11/19 20:44:54 $
27  *
28  *
29  */
30 
31 // Includes
32 #include "objects.h"
33 
34 // C Library Includes
35 
36 // System Library Includes
37 
38 // Master Game Includes
39 
40 // Game Library Includes
41 
42 // Game Object Includes
43 
44 // Defines
45 #define DEFAULT_PERIL_MAX  100
46 #define DEFAULT_PERIL_MIN  1
47 #define DEFAULT_POSIT_MAX  100
48 #define DEFAULT_POSIT_MIN  1
49 #define DEFAULT_MOTION_MAX 100
50 #define DEFAULT_MOTION_MIN 1
51 
52 #define NO_MUSIC_ZONE   0
53 #define HOSPITAL_ZONE   1 // nee Residential
54 #define EXECUTIVE_ZONE  2
55 #define INDUSTRIAL_ZONE 3
56 #define METAL_ZONE      4
57 #define PARK_ZONE       5 // also used in access corridors
58 #define BRIDGE_ZONE     6 // once Outer bridge
59 #define ELEVATOR_ZONE   7
60 
61 #define NUM_EVENTS 9
62 
63 #define WALKING_SCORE 0
64 #define PERIL_SCORE   4
65 #define COMBAT_SCORE  6
66 
67 #define PERIL_THRESHOLD 70
68 
69 #define NO_MONSTER -1
70 #define SMALL_ROBOT 0
71 #define LARGE_ROBOT 1
72 #define MUTANT 2
73 
74 #define SAME_MODE       0
75 #define NORMAL_MODE     1
76 #define TRANSITION_MODE 2
77 
78 #define NUM_TRANSITIONS 9
79 
80 #define TRANS_INTRO         0
81 #define TRANS_WALK_TO_PERIL 1
82 #define TRANS_PERIL_TO_COMB 2
83 #define TRANS_DEATH         3
84 #define TRANS_VICTORY       4
85 #define TRANS_PERIL_TO_WALK 5
86 #define TRANS_COMB_TO_WALK  6
87 #define TRANS_COMB_TO_PERIL 7
88 #define TRANS_WALK_TO_COMB  8
89 
90 #define MONSTER_MUSIC_MUTANT      0
91 #define MONSTER_MUSIC_ROBOT       1
92 #define MONSTER_MUSIC_CYBORG      2
93 #define MONSTER_MUSIC_SMALL_ROBOT 3
94 
95 #define NUM_SCORES                 8
96 #define NUM_LAYERABLE_SUPERCHUNKS 22
97 #define FIRST_SUPERCHUNK_LAYER    16
98 #define NUM_LAYERS                32
99 #define LAYER_BASE                32
100 
101 #define SUPERCHUNKS_PER_SCORE  4
102 #define MAX_KEYS              10
103 #define KEY_BAR_RESOLUTION     2
104 
105 #define NUM_PARK_SOUNDS 10
106 #define PARK_LAYER_BASE 32
107 
108 #define CYBERSPACE_SCORE_BASE 10
109 #define NUM_NODE_THEMES        2
110 
111 #define DANGER_LAYER_BASE     10 // actually one less than Danger1 since a minimum of 1 gets added to it...
112 #define SUCCESS_LAYER_BASE    (DANGER_LAYER_BASE + 2)
113 #define DECONSTRUCT_LAYER     15
114 #define TRANSITION_LAYER_BASE 16
115 
116 // Prototypes
117 
118 // Initialize the AI portion of the MLIMBS system.
119 errtype mlimbs_AI_init(void);
120 void music_ai(void);
121 errtype mai_monster_nearby(int monster_type);
122 errtype mai_attack();
123 errtype mai_intro();
124 errtype mai_monster_defeated();
125 errtype mai_player_death();
126 errtype fade_into_location(int x, int y);
127 errtype load_score_for_location(int x, int y);
128 errtype load_score_from_cfg(char *filename);
129 void load_score_guts(uint8_t score_playing);
130 errtype music_init();
131 errtype digifx_init();
132 errtype stop_digi_fx();
133 void clear_digi_fx();
134 int play_digi_fx_master(int sfx_code, int num_loops, ObjID id, ushort x, ushort y);
135 #define play_digi_fx(sfx_code, loops)               play_digi_fx_master(sfx_code, loops, OBJ_NULL, 0, 0)
136 #define play_digi_fx_obj(sfx_code, num_loops, id)   play_digi_fx_master(sfx_code, num_loops, id, 0, 0)
137 #define play_digi_fx_loc(sfx_code, num_loops, x, y) play_digi_fx_master(sfx_code, num_loops, OBJ_NULL, x, y)
138 errtype play_sound_effect(char *filename);
139 uchar digi_fx_playing(int fx_id, int *handle_ptr);
140 errtype output_text(char *);
141 extern void mlimbs_do_ai(void);
142 extern void digifx_EOS_callback(snd_digi_parms *sdp);
143 
144 extern uchar digi_pan_reverse;
145 
146 void grind_credits_music_ai(void);
147 
148 // Globals
149 #ifdef __MUSICAI_SRC
150 int mlimbs_peril, mlimbs_positive, mlimbs_motion, mlimbs_monster;
151 ulong mlimbs_combat;
152 int current_score, current_zone, current_mode, random_flag;
153 int current_transition, last_score;
154 int boring_count;
155 int mlimbs_boredom;
156 int *output_table;
157 uchar wait_flag;
158 int next_mode, ai_cycle;
159 int cur_digi_channels = 4;
160 #else
161 extern int mlimbs_peril, mlimbs_positive, mlimbs_motion, mlimbs_monster;
162 extern ulong mlimbs_combat;
163 extern int current_score, current_zone, current_mode, random_flag;
164 extern int current_transition, last_score;
165 extern int boring_count;
166 extern int mlimbs_boredom;
167 extern int *output_table;
168 extern uchar wait_flag;
169 extern int next_mode, ai_cycle;
170 extern uchar music_card, music_on;
171 extern uchar /*sfx_card, */ sfx_on;
172 extern int cur_digi_channels;
173 #endif
174 
175 #endif // __MUSICAI_H
176