Mercurial > hg > Members > koba > t_dandy
view collision_task.cc @ 14:c7e7971a76d0
fix.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 16 Dec 2010 15:29:43 +0900 |
parents | e90c4a8f9dc8 |
children | 00c3272a801f |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include <SDL.h> #include "SDL_opengl.h" #include "object.h" #include "Character.h" #include "Character_state.h" #include "tokuten.h" #include "collision.h" #include "bom.h" #include "count2.h" #include "sgoex.h" #include "TaskManager.h" #include "Func.h" #include "property.h" extern SpriteTable sptable[DEFOBJ]; extern TaskManager *tmanager; CollisionPropertyPtr get_property(CHARACTER *p) { CollisionPropertyPtr property = (CollisionPropertyPtr)tmanager->allocate(sizeof(CollisionProperty)); property->bomend = bomend; property->infg_level = infg_level; property->enemycount = 0; property->jiki = jiki; property->p = *p; property->tlv3 = tlv3[0]; property->lg = lg; property->infg = infg; memcpy(property->tama_lv1, &tama_lv1, sizeof(tama1)*20); memcpy(property->tama_lv2, &tama_lv2, sizeof(tama2)*20); memcpy(property->laser_lv1, &laser_lv1, sizeof(laser)*20); memcpy(property->laser_lv2, &laser_lv2, sizeof(laser)*20); memcpy(property->laser_lv3, &laser_lv3, sizeof(laser)*128); memcpy(property->bchar, &bchar, sizeof(bomchar)*100); return property; } void free_property(SchedTask *s, void *prop, void *chara) { CollisionPropertyPtr property = (CollisionPropertyPtr)prop; CHARACTER *character = (CHARACTER *)chara; if(bomend > property->bomend) { bomend = property->bomend; } if(lg.stg > property->lg.stg) { lg.stg -= 26; } infg_level = property->infg_level; enemycount += property->enemycount; jiki.bf = property->jiki.bf; jiki.zanki = property->jiki.zanki; jiki.muteki = property->jiki.muteki; *character = property->p; infg = property->infg; memcpy(tama_lv1, property->tama_lv1, sizeof(tama1)*20); memcpy(tama_lv2, property->tama_lv2, sizeof(tama2)*20); memcpy(laser_lv1, property->laser_lv1, sizeof(laser)*20); memcpy(bchar, property->bchar, sizeof(bomchar)*100); free(prop); } CHARACTER *atari(CHARACTER *p) { int w, h, charno; CollisionPropertyPtr property = get_property(p); charno = p->charano; w = sptable[charno].w; h = sptable[charno].h; HTaskPtr collision_task = tmanager->create_task(ATARI); collision_task->set_param(0,(memaddr)w); collision_task->set_param(1,(memaddr)h); collision_task->set_param(2,(memaddr)enemycount); collision_task->set_param(3,(memaddr)tama_lv1_end); collision_task->set_param(4,(memaddr)tama_lv2_end); collision_task->set_param(5,(memaddr)laser_lv1_end); collision_task->add_inData(property, sizeof(CollisionProperty)); collision_task->add_outData(property, sizeof(CollisionProperty)); collision_task->set_post(free_property, property, p); collision_task->set_cpu(SPE_ANY); collision_task->spawn(); return p; }