| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#include "jacl.h" |
| 7 |
#include "language.h" |
| 8 |
#include "types.h" |
| 9 |
#include "prototypes.h" |
| 10 |
#include "encapsulate.h" |
| 11 |
#include "parser.h" |
| 12 |
|
| 13 |
int |
| 14 |
check_light(int where) |
| 15 |
{ |
| 16 |
int index; |
| 17 |
|
| 18 |
if ((object[where]->attributes & DARK) == FALSE) |
| 19 |
return (TRUE); |
| 20 |
else { |
| 21 |
for (index = 1; index <= objects; index++) { |
| 22 |
if ((object[index]->attributes & LUMINOUS) |
| 23 |
&& scope(index, "*present", FALSE)) |
| 24 |
return (TRUE); |
| 25 |
} |
| 26 |
} |
| 27 |
return (FALSE); |
| 28 |
} |
| 29 |
|
| 30 |
char * |
| 31 |
sentence_output(int index, int capital) |
| 32 |
{ |
| 33 |
if (!strcmp(object[index]->article, "name")) { |
| 34 |
strcpy(temp_buffer, object[index]->inventory); |
| 35 |
} else { |
| 36 |
strcpy(temp_buffer, object[index]->definite); |
| 37 |
strcat(temp_buffer, " "); |
| 38 |
strcat(temp_buffer, object[index]->inventory); |
| 39 |
} |
| 40 |
|
| 41 |
if (capital) |
| 42 |
temp_buffer[0] = toupper(temp_buffer[0]); |
| 43 |
|
| 44 |
return (temp_buffer); |
| 45 |
} |
| 46 |
|
| 47 |
char * |
| 48 |
isnt_output(int index) |
| 49 |
{ |
| 50 |
if (object[index]->attributes & PLURAL) |
| 51 |
return (cstring_resolve("ARENT")->value); |
| 52 |
else |
| 53 |
return (cstring_resolve("ISNT")->value); |
| 54 |
} |
| 55 |
|
| 56 |
char * |
| 57 |
is_output(int index) |
| 58 |
{ |
| 59 |
if (object[index]->attributes & PLURAL) |
| 60 |
return (cstring_resolve("ARE")->value); |
| 61 |
else |
| 62 |
return (cstring_resolve("IS")->value); |
| 63 |
} |
| 64 |
|
| 65 |
char * |
| 66 |
sub_output(int index, int capital) |
| 67 |
{ |
| 68 |
if (object[index]->attributes & PLURAL) { |
| 69 |
strcpy(temp_buffer, cstring_resolve("THEY_WORD")->value); |
| 70 |
} else { |
| 71 |
if (index == player) { |
| 72 |
strcpy(temp_buffer, cstring_resolve("YOU_WORD")->value); |
| 73 |
} else if (object[index]->attributes & ANIMATE) { |
| 74 |
if (object[index]->attributes & FEMALE) { |
| 75 |
strcpy(temp_buffer, cstring_resolve("SHE_WORD")->value); |
| 76 |
} else { |
| 77 |
strcpy(temp_buffer, cstring_resolve("HE_WORD")->value); |
| 78 |
} |
| 79 |
} else { |
| 80 |
strcpy(temp_buffer, cstring_resolve("IT_WORD")->value); |
| 81 |
} |
| 82 |
} |
| 83 |
|
| 84 |
if (capital) |
| 85 |
temp_buffer[0] = toupper(temp_buffer[0]); |
| 86 |
|
| 87 |
return temp_buffer; |
| 88 |
} |
| 89 |
|
| 90 |
char * |
| 91 |
obj_output(int index, int capital) |
| 92 |
{ |
| 93 |
if (object[index]->attributes & PLURAL) { |
| 94 |
strcpy(temp_buffer, cstring_resolve("THEM_WORD")->value); |
| 95 |
} else { |
| 96 |
if (index == player) { |
| 97 |
strcpy(temp_buffer, cstring_resolve("YOURSELF_WORD")->value); |
| 98 |
} else if (object[index]->attributes & ANIMATE) { |
| 99 |
if (object[index]->attributes & FEMALE) { |
| 100 |
strcpy(temp_buffer, cstring_resolve("HER_WORD")->value); |
| 101 |
} else { |
| 102 |
strcpy(temp_buffer, cstring_resolve("HIM_WORD")->value); |
| 103 |
} |
| 104 |
} else { |
| 105 |
strcpy(temp_buffer, cstring_resolve("IT_WORD")->value); |
| 106 |
} |
| 107 |
} |
| 108 |
|
| 109 |
if (capital) |
| 110 |
temp_buffer[0] = toupper(temp_buffer[0]); |
| 111 |
|
| 112 |
return temp_buffer; |
| 113 |
} |
| 114 |
|
| 115 |
char * |
| 116 |
it_output(int index) |
| 117 |
{ |
| 118 |
if (object[index]->attributes & ANIMATE) { |
| 119 |
return sentence_output(index, FALSE); |
| 120 |
} else { |
| 121 |
if (object[index]->attributes & PLURAL) { |
| 122 |
return (cstring_resolve("THEM_WORD")->value); |
| 123 |
} else { |
| 124 |
return (cstring_resolve("IT_WORD")->value); |
| 125 |
} |
| 126 |
} |
| 127 |
} |
| 128 |
|
| 129 |
char * |
| 130 |
that_output(int index, int capital) |
| 131 |
{ |
| 132 |
if (object[index]->attributes & PLURAL) { |
| 133 |
strcpy(temp_buffer, cstring_resolve("THOSE_WORD")->value); |
| 134 |
} else { |
| 135 |
strcpy(temp_buffer, cstring_resolve("THAT_WORD")->value); |
| 136 |
} |
| 137 |
|
| 138 |
if (capital) |
| 139 |
temp_buffer[0] = toupper(temp_buffer[0]); |
| 140 |
|
| 141 |
return temp_buffer; |
| 142 |
} |
| 143 |
|
| 144 |
char * |
| 145 |
doesnt_output(int index) |
| 146 |
{ |
| 147 |
if (object[index]->attributes & PLURAL) |
| 148 |
return (cstring_resolve("DONT")->value); |
| 149 |
else |
| 150 |
return (cstring_resolve("DOESNT")->value); |
| 151 |
} |
| 152 |
|
| 153 |
char * |
| 154 |
does_output(int index) |
| 155 |
{ |
| 156 |
if (object[index]->attributes & PLURAL) |
| 157 |
return (cstring_resolve("DO")->value); |
| 158 |
else |
| 159 |
return (cstring_resolve("DOES")->value); |
| 160 |
} |
| 161 |
|
| 162 |
char * |
| 163 |
list_output(int index, int capital) |
| 164 |
{ |
| 165 |
if (!strcmp(object[index]->article, "name")) { |
| 166 |
strcpy(temp_buffer, object[index]->inventory); |
| 167 |
} else { |
| 168 |
strcpy(temp_buffer, object[index]->article); |
| 169 |
strcat(temp_buffer, " "); |
| 170 |
strcat(temp_buffer, object[index]->inventory); |
| 171 |
} |
| 172 |
|
| 173 |
if (capital) |
| 174 |
temp_buffer[0] = toupper(temp_buffer[0]); |
| 175 |
|
| 176 |
return (temp_buffer); |
| 177 |
} |
| 178 |
|
| 179 |
char * |
| 180 |
plain_output(int index, int capital) |
| 181 |
{ |
| 182 |
strcpy(temp_buffer, object[index]->inventory); |
| 183 |
|
| 184 |
if (capital) |
| 185 |
temp_buffer[0] = toupper(temp_buffer[0]); |
| 186 |
|
| 187 |
return (temp_buffer); |
| 188 |
} |
| 189 |
|
| 190 |
char * |
| 191 |
long_output(int index) |
| 192 |
{ |
| 193 |
if (!strcmp(object[index]->described, "function")) { |
| 194 |
strcpy(function_name, "long_"); |
| 195 |
strcat(function_name, object[index]->label); |
| 196 |
if (execute(function_name) == FALSE) { |
| 197 |
unkfunrun(function_name); |
| 198 |
} |
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
temp_buffer[0] = 0; |
| 203 |
return (temp_buffer); |
| 204 |
} else { |
| 205 |
return (object[index]->described); |
| 206 |
} |
| 207 |
} |
| 208 |
|
| 209 |
void |
| 210 |
no_it() |
| 211 |
{ |
| 212 |
write_text(cstring_resolve("NO_IT")->value); |
| 213 |
write_text(word[wp]); |
| 214 |
write_text(cstring_resolve("NO_IT_END")->value); |
| 215 |
custom_error = TRUE; |
| 216 |
} |
| 217 |
|
| 218 |
void |
| 219 |
look_around() |
| 220 |
{ |
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
if (!check_light(HERE)) { |
| 225 |
|
| 226 |
|
| 227 |
execute("+dark_description"); |
| 228 |
return; |
| 229 |
} |
| 230 |
|
| 231 |
if (execute("+before_look") != FALSE) |
| 232 |
return; |
| 233 |
|
| 234 |
execute("+title"); |
| 235 |
|
| 236 |
if (DISPLAY_MODE->value) { |
| 237 |
|
| 238 |
|
| 239 |
object[HERE]->attributes &= ~1L; |
| 240 |
} |
| 241 |
|
| 242 |
strcpy(function_name, "look_"); |
| 243 |
strcat(function_name, object[HERE]->label); |
| 244 |
execute(function_name); |
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
object[HERE]->attributes = object[HERE]->attributes | KNOWN; |
| 249 |
object[HERE]->attributes = object[HERE]->attributes | VISITED; |
| 250 |
object[HERE]->attributes = object[HERE]->attributes | MAPPED; |
| 251 |
|
| 252 |
execute("+object_descriptions"); |
| 253 |
|
| 254 |
strcpy(function_name, "after_look_"); |
| 255 |
strcat(function_name, object[HERE]->label); |
| 256 |
execute(function_name); |
| 257 |
|
| 258 |
execute("+after_look"); |
| 259 |
} |