Mercurial > hg > Members > koba > t_dandy
view collision_task.cc @ 70:cee55c8365e9 default tip
fix
author | Kazuma |
---|---|
date | Thu, 19 May 2016 18:52:26 +0900 |
parents | 6989f8cb0259 |
children | b31bed246abd |
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->enemycount = 0; property->tlv3 = tlv3[0]; property->laser_lv2 = laser_lv2[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_lv3, laser_lv3, sizeof(laser)*128); return property; } void free_property(SchedTask *s, void *prop, void *obj) { CollisionPropertyPtr property = (CollisionPropertyPtr)prop; ObjContainer *new_obj = (ObjContainerPtr)obj; if ((new_obj->flag == true) && (new_obj->length == 1)){ ObjDataPtr obj_data = new_obj->data; Bom(obj_data->x, obj_data->y); } 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); free(new_obj); 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; int obj_size = sizeof(ObjContainer)+sizeof(ObjData)*1; ObjContainerPtr obj = (ObjContainerPtr)tmanager->allocate(obj_size); obj->flag = false; obj->length = 0; 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->set_inData(0, p, sizeof(CHARACTER)); collision_task->set_inData(1, &jiki, sizeof(player)); collision_task->set_inData(2, &lg, sizeof(stge)); collision_task->set_inData(3, &infg, sizeof(stge)); collision_task->set_inData(4, &infg_level, sizeof(int)); collision_task->set_inData(5, property, sizeof(CollisionProperty)); collision_task->set_outData(0, p, sizeof(CHARACTER)); collision_task->set_outData(1, property, sizeof(CollisionProperty)); collision_task->set_outData(2, obj, 0); collision_task->set_post(free_property, (void*)property, (void*)obj); collision_task->set_cpu(SPE_ANY); collision_task->spawn(); return p; }