[Tuxracer-checkins] CVS: tuxracer/src course_load.c,1.23,1.24 course_load.h,1.11,1.12
Status: Beta
Brought to you by:
jfpatry
From: Jasmin P. <jf...@us...> - 2000-09-16 16:49:25
|
Update of /cvsroot/tuxracer/tuxracer/src In directory slayer.i.sourceforge.net:/tmp/cvs-serv5615 Modified Files: course_load.c course_load.h Log Message: - Fixed bug in which collectable flag wasn't being initialized - Some clean up: s/numtrees/num_tress/, s/numitems/num_items/, etc. Index: course_load.c =================================================================== RCS file: /cvsroot/tuxracer/tuxracer/src/course_load.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** course_load.c 2000/09/16 01:31:36 1.23 --- course_load.c 2000/09/16 16:49:22 1.24 *************** *** 72,76 **** static int nx, ny; static tree_t tree_locs[MAX_TREES]; ! static int numtrees; static terrain_t *terrain; static point2d_t start_pt; --- 72,76 ---- static int nx, ny; static tree_t tree_locs[MAX_TREES]; ! static int num_trees; static terrain_t *terrain; static point2d_t start_pt; *************** *** 85,89 **** static item_type_t item_types[MAX_ITEM_TYPES]; static int num_item_types = 0; ! static int numitems; /* Interleaved vertex, normal, and color data */ --- 85,89 ---- static item_type_t item_types[MAX_ITEM_TYPES]; static int num_item_types = 0; ! static int num_items; /* Interleaved vertex, normal, and color data */ *************** *** 94,98 **** scalar_t get_course_angle() { return course_angle; } tree_t *get_tree_locs() { return tree_locs; } ! int get_num_trees() { return numtrees; } polyhedron_t get_tree_polyhedron(int type) { return tree_types[type].poly; } char *get_tree_name(int type) { return tree_types[type].name; } --- 94,98 ---- scalar_t get_course_angle() { return course_angle; } tree_t *get_tree_locs() { return tree_locs; } ! int get_num_trees() { return num_trees; } polyhedron_t get_tree_polyhedron(int type) { return tree_types[type].poly; } char *get_tree_name(int type) { return tree_types[type].name; } *************** *** 103,107 **** item_t *get_item_locs() { return item_locs; } ! int get_num_items() { return numitems; } char *get_item_name(int type) { return item_types[type].name; } --- 103,107 ---- item_t *get_item_locs() { return item_locs; } ! int get_num_items() { return num_items; } char *get_item_name(int type) { return item_types[type].name; } *************** *** 178,183 **** */ course_number = -1; ! numtrees = 0; ! numitems = 0; course_angle = 20.; course_width = 50.; --- 178,183 ---- */ course_number = -1; ! num_trees = 0; ! num_items = 0; course_angle = 20.; course_width = 50.; *************** *** 223,227 **** tree_types[i].poly.num_vertices = 0; tree_types[i].poly.num_polygons = 0; ! tree_types[i].numtrees = 0; } num_tree_types = 0; --- 223,227 ---- tree_types[i].poly.num_vertices = 0; tree_types[i].poly.num_polygons = 0; ! tree_types[i].num_trees = 0; } num_tree_types = 0; *************** *** 232,236 **** free( item_types[i].name ); free( item_types[i].texture ); ! tree_types[i].numtrees = 0; } num_item_types = 0; --- 232,236 ---- free( item_types[i].name ); free( item_types[i].texture ); ! item_types[i].num_items = 0; } num_item_types = 0; *************** *** 602,606 **** type->diam = 2.0; type->height = 4.5; ! type->numtrees = 0; } --- 602,606 ---- type->diam = 2.0; type->height = 4.5; ! type->num_trees = 0; } *************** *** 833,838 **** } ! check_assertion(num_tree_types > 0, "read in tree positions with no tree " ! "types set"); sx = treeImg->sizeX; --- 833,838 ---- } ! check_assertion( num_tree_types > 0, "read in tree positions with no tree " ! "types set"); sx = treeImg->sizeX; *************** *** 850,855 **** } ! numtrees = 0; ! numitems = 0; pad = 0; for (y=0; y<sy; y++) { --- 850,855 ---- } ! num_trees = 0; ! num_items = 0; pad = 0; for (y=0; y<sy; y++) { *************** *** 861,871 **** if ( best_tree_dist < best_item_dist && which_tree != NULL ) { ! if (numtrees+1 == MAX_TREES ) { fprintf( stderr, "%s: maximum number of trees reached.\n", argv[0] ); break; } ! numtrees += 1; ! which_tree->numtrees += 1; pos = (point2d_t *) malloc(sizeof(point2d_t)); pos->x = (sx-x)/(scalar_t)(sx-1.)*course_width; --- 861,871 ---- if ( best_tree_dist < best_item_dist && which_tree != NULL ) { ! if (num_trees+1 == MAX_TREES ) { fprintf( stderr, "%s: maximum number of trees reached.\n", argv[0] ); break; } ! num_trees += 1; ! which_tree->num_trees += 1; pos = (point2d_t *) malloc(sizeof(point2d_t)); pos->x = (sx-x)/(scalar_t)(sx-1.)*course_width; *************** *** 875,885 **** } else if ( which_item != NULL ) { ! if (numitems+1 == MAX_TREES ) { ! fprintf( stderr, "%s: maximum number of trees reached.\n", argv[0] ); break; } ! numitems += 1; ! which_item->numitems += 1; pos = (point2d_t *) malloc(sizeof(point2d_t)); pos->x = (sx-x)/(scalar_t)(sx-1.)*course_width; --- 875,885 ---- } else if ( which_item != NULL ) { ! if (num_items+1 == MAX_ITEMS ) { ! fprintf( stderr, "%s: maximum number of items reached.\n", argv[0] ); break; } ! num_items += 1; ! which_item->num_items += 1; pos = (point2d_t *) malloc(sizeof(point2d_t)); pos->x = (sx-x)/(scalar_t)(sx-1.)*course_width; *************** *** 897,901 **** // texture switching */ ! numtrees = 0; for (i = 0; i < num_tree_types; i++) { elem = get_list_head(tree_types[i].pos); --- 897,901 ---- // texture switching */ ! num_trees = 0; for (i = 0; i < num_tree_types; i++) { elem = get_list_head(tree_types[i].pos); *************** *** 903,928 **** pos = (point2d_t *) get_list_elem_data(tree_types[i].pos, elem); ! tree_locs[numtrees].ray.pt.x = pos->x; ! tree_locs[numtrees].ray.pt.z = pos->y; ! tree_locs[numtrees].ray.pt.y = find_y_coord( pos->x, pos->y ); free( pos ); elem = get_next_list_elem(tree_types[i].pos, elem); ! tree_locs[numtrees].ray.vec = make_vector( 0, 1, 0); ! tree_locs[numtrees].height = (scalar_t)rand()/RAND_MAX*tree_types[i].vary*2; ! tree_locs[numtrees].height -= tree_types[i].vary; ! tree_locs[numtrees].height = tree_types[i].height + ! tree_locs[numtrees].height * tree_types[i].height; ! tree_locs[numtrees].diam = (tree_locs[numtrees].height / tree_types[i].height) * tree_types[i].diam; ! tree_locs[numtrees].tree_type = i; ! numtrees++; } del_list( tree_types[i].pos ); } ! numitems = 0; for (i = 0; i < num_item_types; i++) { elem = get_list_head(item_types[i].pos); --- 903,928 ---- pos = (point2d_t *) get_list_elem_data(tree_types[i].pos, elem); ! tree_locs[num_trees].ray.pt.x = pos->x; ! tree_locs[num_trees].ray.pt.z = pos->y; ! tree_locs[num_trees].ray.pt.y = find_y_coord( pos->x, pos->y ); free( pos ); elem = get_next_list_elem(tree_types[i].pos, elem); ! tree_locs[num_trees].ray.vec = make_vector( 0, 1, 0); ! tree_locs[num_trees].height = (scalar_t)rand()/RAND_MAX*tree_types[i].vary*2; ! tree_locs[num_trees].height -= tree_types[i].vary; ! tree_locs[num_trees].height = tree_types[i].height + ! tree_locs[num_trees].height * tree_types[i].height; ! tree_locs[num_trees].diam = (tree_locs[num_trees].height / tree_types[i].height) * tree_types[i].diam; ! tree_locs[num_trees].tree_type = i; ! num_trees++; } del_list( tree_types[i].pos ); } ! num_items = 0; for (i = 0; i < num_item_types; i++) { elem = get_list_head(item_types[i].pos); *************** *** 930,949 **** pos = (point2d_t *) get_list_elem_data(item_types[i].pos, elem); ! item_locs[numitems].ray.pt.x = pos->x; ! item_locs[numitems].ray.pt.z = pos->y; ! item_locs[numitems].ray.pt.y = find_y_coord( pos->x, pos->y ) + item_types[i].above_ground; free( pos ); elem = get_next_list_elem(item_types[i].pos, elem); ! item_locs[numitems].ray.vec = make_vector( 0, 1, 0); ! item_locs[numitems].height = item_types[i].height ; ! item_locs[numitems].diam = item_types[i].diam; ! item_locs[numitems].item_type = i; if ( item_types[i].nocollision ) { ! item_locs[numitems].collectable = -1; } ! numitems++; } del_list( item_types[i].pos ); --- 930,951 ---- pos = (point2d_t *) get_list_elem_data(item_types[i].pos, elem); ! item_locs[num_items].ray.pt.x = pos->x; ! item_locs[num_items].ray.pt.z = pos->y; ! item_locs[num_items].ray.pt.y = find_y_coord( pos->x, pos->y ) + item_types[i].above_ground; free( pos ); elem = get_next_list_elem(item_types[i].pos, elem); ! item_locs[num_items].ray.vec = make_vector( 0, 1, 0); ! item_locs[num_items].height = item_types[i].height ; ! item_locs[num_items].diam = item_types[i].diam; ! item_locs[num_items].item_type = i; if ( item_types[i].nocollision ) { ! item_locs[num_items].collectable = -1; ! } else { ! item_locs[num_items].collectable = 1; } ! num_items++; } del_list( item_types[i].pos ); *************** *** 1278,1282 **** tree_types[num_tree_types].poly.polygons = 0; tree_types[num_tree_types].texture = (char *)0; ! tree_types[num_tree_types].numtrees = 0; for ( i = 1; (i < argc - 1) && !error; i += 2 ) { --- 1280,1284 ---- tree_types[num_tree_types].poly.polygons = 0; tree_types[num_tree_types].texture = (char *)0; ! tree_types[num_tree_types].num_trees = 0; for ( i = 1; (i < argc - 1) && !error; i += 2 ) { *************** *** 1425,1429 **** item_types[num_item_types].height = 0.5; item_types[num_item_types].above_ground = 0.0; ! item_types[num_item_types].numitems = 0; item_types[num_item_types].nocollision = False; --- 1427,1431 ---- item_types[num_item_types].height = 0.5; item_types[num_item_types].above_ground = 0.0; ! item_types[num_item_types].num_items = 0; item_types[num_item_types].nocollision = False; Index: course_load.h =================================================================== RCS file: /cvsroot/tuxracer/tuxracer/src/course_load.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** course_load.h 2000/09/15 21:05:50 1.11 --- course_load.h 2000/09/16 16:49:22 1.12 *************** *** 74,78 **** polyhedron_t poly; char * texture; ! int numtrees; unsigned char red, green, blue; list_t pos; --- 74,78 ---- polyhedron_t poly; char * texture; ! int num_trees; unsigned char red, green, blue; list_t pos; *************** *** 91,95 **** list_t pos; list_elem_t insert_pos; ! int numitems; } item_type_t; --- 91,95 ---- list_t pos; list_elem_t insert_pos; ! int num_items; } item_type_t; |