#include "pacmanmaze1.c"
FONT* arial_font = "Arial#20";
var i = 0; // used as an index
var active_agents = 0;
STRING* name_str = "#30";
var speed = 50;
BMAP* mouse_pcx = "mouse.pcx";
TEXT* models_txt =
{
strings = 100;
}
PANEL* output_pan =
{
digits (120, 120, "Character name: %s ", arial_font, 1, name_str);
flags = SHOW;
}
typedef struct {
STRING* name;
ENTITY* agent_model;
} AGENTS;
AGENTS* taskforces[100];
[color:#FF6600]function rotate_agent()[/color]
{
while (active_agents)
{
my.pan += 4 * time_step;
wait (1);
}
ent_remove(my);
}
function create_agent(STRING *agent_name)
{
AGENTS* temp_agent = malloc(sizeof(AGENTS));
temp_agent.name = str_create(agent_name);
temp_agent.agent_model = ent_create(agent_name, vector(130, 0, -10), rotate_agent);
str_trunc(temp_agent.name, 4);
return temp_agent;
}
function main()
{
video_screen = 1;
mouse_map = mouse_pcx;
mouse_mode = 4;
var counter = 0;
level_load (NULL);
int j;
for(j = 0; j < 100; j++)
taskforces[j] = malloc(sizeof(AGENTS));
txt_for_dir(models_txt, "*.mdl");
while (str_len((models_txt.pstring)[i]) > 0)
{
i++;
}
i--;
while (1)
{
active_agents = 0;
wait (2);
active_agents = 1;
taskforces[i] = create_agent((models_txt.pstring)[counter]);
str_cpy(name_str, taskforces[i].name);
while (!key_cud && !key_cuu) {wait (1);}
counter += key_cud - key_cuu;
counter = clamp(counter, 0, i);
while (key_cud || key_cuu) {wait (1);}
}
}
PANEL* menu=
{
button (600, 500, "player_OVER.pcx", "player_OUT.pcx", "player_OVER.pcx", load_program, NULL, NULL);
flags = OVERLAY | SHOW;
}
function load_program()
{
while (key_any) {wait (1);}
level_load("pmaze1.wmb");
output_pan.flags &= ~SHOW;
menu.flags &= ~SHOW;
}