Skip to content

Commit

Permalink
Added support for max_actors
Browse files Browse the repository at this point in the history
  • Loading branch information
learner committed Jan 1, 2004
1 parent 2d814ef commit ccbf399
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 54 deletions.
7 changes: 2 additions & 5 deletions gl_init.c
Expand Up @@ -389,8 +389,7 @@ void set_new_video_mode(int fs,int mode)
}

//do the same for the actors textures...
i=0;
while(i<1000)
for(i=0;i<max_actors;i++)
{
if(actors_list[i])
{
Expand All @@ -400,7 +399,6 @@ void set_new_video_mode(int fs,int mode)
actors_list[i]->texture_id=0;
}
}
i++;
}

//destroy the current context
Expand Down Expand Up @@ -434,8 +432,7 @@ void set_new_video_mode(int fs,int mode)
}

//do the same for the actors textures...
i=0;
while(i<1000)
for(i=0;i<max_actors;i++)
{
if(actors_list[i])
{
Expand Down
67 changes: 33 additions & 34 deletions interface.c
Expand Up @@ -1950,45 +1950,45 @@ void draw_game_map()
{
int screen_x;
int screen_y;
int i=0;
int i;

glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);

glViewport(0, 0, window_width, window_height);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
//glOrtho(0.0, (GLdouble)500, (GLdouble)500, 0.0, -250.0, 250.0);
glOrtho(300, (GLdouble)0, (GLdouble)0, 200, -250.0, 250.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glViewport(0, 0, window_width, window_height);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
//glOrtho(0.0, (GLdouble)500, (GLdouble)500, 0.0, -250.0, 250.0);
glOrtho(300, (GLdouble)0, (GLdouble)0, 200, -250.0, 250.0);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();


glBindTexture(GL_TEXTURE_2D, map_text);
last_texture=-1;
glBindTexture(GL_TEXTURE_2D, map_text);
last_texture=-1;

glColor3f(1.0f,1.0f,1.0f);
glBegin(GL_QUADS);
//draw the texture
glColor3f(1.0f,1.0f,1.0f);
glBegin(GL_QUADS);
//draw the texture

glTexCoord2f(1.0f,0.0f);
glVertex3i(50,0,0);
glTexCoord2f(1.0f,0.0f);
glVertex3i(50,0,0);

glTexCoord2f(1.0f,1.0f);
glVertex3i(50,200,0);
glTexCoord2f(1.0f,1.0f);
glVertex3i(50,200,0);

glTexCoord2f(0.0f,1.0f);
glVertex3i(250,200,0);
glTexCoord2f(0.0f,1.0f);
glVertex3i(250,200,0);

glTexCoord2f(0.0f,0.0f);
glVertex3i(250,0,0);
glTexCoord2f(0.0f,0.0f);
glVertex3i(250,0,0);

glEnd();

//ok, now let's draw our possition...
while(i<1000)
for(i=0;i<max_actors;i++)
{
if(actors_list[i])
if(actors_list[i]->actor_id==yourself)
Expand All @@ -1999,7 +1999,6 @@ void draw_game_map()
screen_y=0+200*y/(tile_map_size_y*6);
break;
}
i++;
}

glColor3f(0.0f,0.0f,1.0f);
Expand All @@ -2017,14 +2016,14 @@ void draw_game_map()
glColor3f(1.0f,1.0f,1.0f);


glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);

glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
}

void draw_menu_title_bar(int x, int y, int x_len)
Expand Down
21 changes: 8 additions & 13 deletions new_actors.c
Expand Up @@ -111,11 +111,9 @@ int add_enhanced_actor(enhanced_actor *this_actor,char * frame_name,float x_pos,
our_actor = calloc(1, sizeof(actor));

//find a free spot, in the actors_list
i=0;
while(i<1000)
for(i=0;i<max_actors;i++)
{
if(!actors_list[i])break;
i++;
}

//ok, load the legs
Expand Down Expand Up @@ -269,6 +267,7 @@ int add_enhanced_actor(enhanced_actor *this_actor,char * frame_name,float x_pos,
our_actor->body_parts=this_actor;

actors_list[i]=our_actor;
if(i>=max_actors)max_actors=i+1;
no_bounding_box=0;
return i;
}
Expand Down Expand Up @@ -429,9 +428,9 @@ void draw_enhanced_actor(actor * actor_id)

void unwear_item_from_actor(int actor_id,Uint8 which_part)
{
int i=0;
int i;

while(i<1000)
for(i=0;i<max_actors;i++)
{
if(actors_list[i])
if(actors_list[i]->actor_id==actor_id)
Expand Down Expand Up @@ -470,16 +469,15 @@ void unwear_item_from_actor(int actor_id,Uint8 which_part)

return;
}
i++;
}

}

void actor_wear_item(int actor_id,Uint8 which_part, Uint8 which_id)
{
int i=0;
int i;

while(i<1000)
for(i=0;i<max_actors;i++)
{
if(actors_list[i])
if(actors_list[i]->actor_id==actor_id)
Expand Down Expand Up @@ -547,7 +545,6 @@ void actor_wear_item(int actor_id,Uint8 which_part, Uint8 which_id)
}
return;
}
i++;
}

}
Expand Down Expand Up @@ -658,13 +655,11 @@ void add_enhanced_actor_from_server(char * in_data)

//find out if there is another actor with that ID
//ideally this shouldn't happen, but just in case
i=0;
while(i<1000)
for(i=0;i<max_actors;i++)
{
if(actors_list[i])
if(actors_list[i]->actor_id==actor_id)
destroy_actor(i);//we don't want two actors with thesame ID
i++;
destroy_actor(i);//we don't want two actors with thesame ID
}

this_actor=calloc(1,sizeof(enhanced_actor));
Expand Down
2 changes: 1 addition & 1 deletion reflection.c
Expand Up @@ -500,7 +500,7 @@ void display_3d_reflection()
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glNormal3f(0.0f,0.0f,1.0f);
for(i=0;i<1000;i++)
for(i=0;i<max_actors;i++)
{
if(actors_list[i])
{
Expand Down
2 changes: 1 addition & 1 deletion shadows.c
Expand Up @@ -363,7 +363,7 @@ void display_actors_shadow()
int x,y;
x=-cx;
y=-cy;
for(i=0;i<1000;i++)
for(i=0;i<max_actors;i++)
{
if(actors_list[i])
{
Expand Down

0 comments on commit ccbf399

Please sign in to comment.