replacement for strtok_r
This commit is contained in:
parent
82a82a747f
commit
b4feea1cb6
3 changed files with 13 additions and 13 deletions
|
@ -17,7 +17,6 @@ void parse_obj(char *filename, ObjFileData *data) {
|
|||
FILE *fp = fopen(filename, "rb");
|
||||
|
||||
char line[256];
|
||||
char cbuf[128];
|
||||
Vector buf;
|
||||
char mode;
|
||||
int linen = 0;
|
||||
|
@ -63,24 +62,25 @@ void parse_obj(char *filename, ObjFileData *data) {
|
|||
}
|
||||
} else if(mode == 'f') {
|
||||
char *segment, *seg;
|
||||
char *ctmp;
|
||||
int j = 0, jj;
|
||||
IVector ibuf;
|
||||
memset(ibuf, 0, sizeof(ibuf));
|
||||
|
||||
while((segment = strtok(NULL, " \n"))) {
|
||||
memset(cbuf, 0, sizeof(cbuf));
|
||||
strncpy(cbuf, segment, sizeof(cbuf));
|
||||
j++;
|
||||
seg = segment;
|
||||
j++;
|
||||
|
||||
jj = 0;
|
||||
while((seg = strtok_r(jj == 0 ? cbuf : NULL, "/", &ctmp))) {
|
||||
if(jj >= 3)
|
||||
break;
|
||||
|
||||
while(jj < 3) {
|
||||
ibuf[jj] = atoi(seg);
|
||||
|
||||
jj++;
|
||||
|
||||
while(*seg != '\0' && *(++seg) != '/');
|
||||
|
||||
if(*seg == '\0')
|
||||
break;
|
||||
else
|
||||
seg++;
|
||||
}
|
||||
|
||||
if(strstr(segment, "//")) {
|
||||
|
@ -94,7 +94,7 @@ void parse_obj(char *filename, ObjFileData *data) {
|
|||
data->indices = realloc(data->indices, sizeof(IVector)*(++data->icount));
|
||||
memcpy(data->indices[data->icount-1], ibuf, sizeof(IVector));
|
||||
}
|
||||
|
||||
|
||||
if(data->fverts == 0)
|
||||
data->fverts = j;
|
||||
|
||||
|
|
|
@ -196,6 +196,7 @@ void stage3_start() {
|
|||
// bgcontext.cx[1] = 2000;
|
||||
// bgcontext.cx[2] = 130;
|
||||
// bgcontext.cv[1] = 10;
|
||||
// bgcontext.crot[0] = 80;
|
||||
|
||||
add_model(&bgcontext, stage3_lake_draw, stage3_lake_pos);
|
||||
add_model(&bgcontext, stage3_fountain_draw, stage3_fountain_pos);
|
||||
|
|
|
@ -273,9 +273,8 @@ void kurumi_redspike(Boss *b, int time) {
|
|||
FROM_TO(0, 500, 100) {
|
||||
int i;
|
||||
int n = global.diff*4;
|
||||
float f = frand();
|
||||
for(i = 0; i < n; i++)
|
||||
create_projectile2c("bigball", b->pos, rgb(1,0,0), asymptotic, 2*cexp(2I*M_PI/n*i+I*f), 3);
|
||||
create_projectile2c("bigball", b->pos, rgb(1,0,0), asymptotic, 2*cexp(2I*M_PI/n*i+I*carg(global.plr.pos-b->pos)), 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue