1 registered members (TipmyPip),
18,709
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: video memory issue ... maybe you can have a short look
[Re: jcl]
#248940
01/30/09 08:01
01/30/09 08:01
|
Joined: Feb 2006
Posts: 1,011 Germany
pegamode
OP
Serious User
|
OP
Serious User
Joined: Feb 2006
Posts: 1,011
Germany
|
Those entities are the playable characters of the game. At every level change I check (after loading the level) which of those characters are located in the current level and get their position. Then I use ent_create to put those characters at the saved position inside this level. That's the code I use:
function check_character(CHARACTER* c_player, ENTITY* ent_player) {
if (ent_player != NULL) {
return; // returning from check_character. player was already set.
}
if (str_cmp(c_player.isInRoom,level_wmb) == 1) {
c_player.isInCurrentRoom = 1;
c_player.head = NULL;
c_player.entity = NULL;
ent_player = ent_create (c_player.mdl, c_player.position, player_movement);
ent_player.CHARACTER_POINTER = c_player;
ent_player.emask |= ENABLE_IMPACT;
ent_player.event = push_event;
VECTOR tmp;
vec_for_vertex(tmp, ent_player, c_player.headVertex);
c_player.head = ent_create (c_player.headMdl, tmp, NULL);
ent_player.HEAD_POINTER = c_player.head;
ent_player.pan = c_player->rotation.pan;
ent_player.tilt = c_player->rotation.tilt;
ent_player.roll = c_player->rotation.roll;
ent_player.link.name = c_player.displayName;
ent_player.string1 = _chr(c_player.displayName);
ent_player.scale_x = c_player->scale.x;
ent_player.scale_y = c_player->scale.y;
ent_player.scale_z = c_player->scale.z;
c_player->head.pan = c_player->rotation.pan;
c_player->head.tilt = c_player->rotation.tilt;
c_player->head.roll = c_player->rotation.roll;
c_player->head.scale_x = c_player->scale.x;
c_player->head.scale_y = c_player->scale.y;
c_player->head.scale_z = c_player->scale.z;
c_player.entity = ent_player;
wait(1);
ent_player.flags = NARROW | FAT | FLAG2 | FLAG7 | FLAG8 | POLYGON | SHADOW | CAST;
c_player.head.flags = PASSABLE | SHADOW | CAST;
c_setminmax(ent_player);
c_updatehull(ent_player,2);
} else {
c_player.entity = NULL;
c_player.isInCurrentRoom = 0;
}
}
|
|
|
|