================= PC_Script_Parse ================= */
| 286 | ================= |
| 287 | */ |
| 288 | qboolean PC_Script_Parse(const char **out) |
| 289 | { |
| 290 | char script[4096]; |
| 291 | // pc_token_t token; |
| 292 | char *token2; |
| 293 | |
| 294 | script[0]=0; |
| 295 | // scripts start with { and have ; separated command lists.. commands are command, arg.. |
| 296 | // basically we want everything between the { } as it will be interpreted at run time |
| 297 | |
| 298 | token2 = PC_ParseExt(); |
| 299 | if (!token2) |
| 300 | { |
| 301 | return qfalse; |
| 302 | } |
| 303 | |
| 304 | if (*token2 !='{') |
| 305 | { |
| 306 | return qfalse; |
| 307 | } |
| 308 | |
| 309 | while ( 1 ) |
| 310 | { |
| 311 | token2 = PC_ParseExt(); |
| 312 | if (!token2) |
| 313 | { |
| 314 | return qfalse; |
| 315 | } |
| 316 | |
| 317 | if (*token2 =='}') // End of the script? |
| 318 | { |
| 319 | *out = String_Alloc(script); |
| 320 | return qtrue; |
| 321 | } |
| 322 | |
| 323 | if (*(token2 +1) != '\0') |
| 324 | { |
| 325 | Q_strcat(script, sizeof(script), va("\"%s\"", token2)); |
| 326 | } |
| 327 | else |
| 328 | { |
| 329 | Q_strcat(script, sizeof(script), token2); |
| 330 | } |
| 331 | Q_strcat(script, sizeof(script), " "); |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | //-------------------------------------------------------------------------------------------- |
| 336 | // Menu Keyword Parse functions |
no test coverage detected