Mercurial > hg > Members > koba > t_dandy
view collision_task.cc @ 27:871f7d9a2f35
running.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 27 Dec 2010 17:21:24 +0900 |
parents | 00c3272a801f |
children | 813f5461daab |
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() { CollisionPropertyPtr property = (CollisionPropertyPtr)tmanager->allocate(sizeof(CollisionProperty)); property->bomend = bomend; property->enemycount = 0; property->infg_level = infg_level; property->lg = lg; property->infg = infg; property->jiki = jiki; property->tlv3 = tlv3[0]; 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 *arg) { CollisionPropertyPtr property = (CollisionPropertyPtr)prop; 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; 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(); 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)tama_lv1_end); collision_task->set_param(3,(memaddr)tama_lv2_end); collision_task->set_param(4,(memaddr)laser_lv1_end); collision_task->add_inData(property, sizeof(CollisionProperty)); collision_task->add_inData(p, sizeof(CHARACTER)); collision_task->add_outData(property, sizeof(CollisionProperty)); collision_task->add_outData(p, sizeof(CHARACTER)); collision_task->set_post(free_property, (void*)property, NULL); collision_task->set_cpu(SPE_ANY); collision_task->spawn(); return p; }