Mercurial > hg > old > magoroku_racing.bad
view carNode.cc @ 132:d84ee8b2cfd9
camera position update
author | Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 21 Jul 2011 17:25:59 +0900 |
parents | 586d68c42c5d |
children |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include "libps2.h" #include "ps2util.h" #include "car.h" #include "game.h" #include "carNode.h" #include "gSprite.h" /* --- car.c --- */ void car_destroy(CarPtr car); // Carポインターの最初。Rootって言うの? static CarPtr car_list; void carNode_append(CarPtr newCar) { printf("carNode_append()\n"); CarPtr p = car_list; if (!p) { // ここでCar構造体のルート部分設定 car_list = newCar; } else { // car_listの最後に追加 while (p->next) p = p->next; p->next = newCar; } } void carNode_draw(CarPtr car) { CarPtr p = car_list; memcpy(p->body->xyz, car->location, sizeof(FVECTOR)); memcpy(p->body->angle, car->direction, sizeof(FVECTOR)); /* printf("car->speed = %f ", p->speed); printf("\n"); printf("p->body->xyz[y] = %f ", p->body->xyz[1]); printf("p->body->xyz[z] = %f ", p->body->xyz[2]); printf("p->body->xyz[3] = %f ", p->body->xyz[3]); printf("\n"); printf("p->location[x] = %f ", p->location[0]); printf("p->location[y] = %f ", p->location[1]); printf("p->location[z] = %f ", p->location[2]); printf("p->location[3] = %f ", p->location[3]); printf("\n"); */ // 登録した車の数だけ繰り返す? // けど、どうぜ1台しかいないんじゃないの? //while (p) { gSprite_PutObject( CHOICE_CAR, p->body ); //ps2util_obj_Draw(p->body); //p = p->next; //} } void carNode_destroy() { CarPtr p = car_list; while (p) { car_destroy(p); p = p->next; } car_list = NULL; }