5
|
1 #include <stdio.h>
|
|
2 #include <stdlib.h>
|
|
3 #include <SDL.h>
|
|
4 #include "SDL_opengl.h"
|
|
5 #include "object.h"
|
|
6 #include "Character.h"
|
|
7 #include "Character_state.h"
|
|
8 #include "tokuten.h"
|
|
9 #include "collision.h"
|
|
10 #include "bom.h"
|
|
11 #include "count2.h"
|
|
12 #include "sgoex.h"
|
|
13 #include "TaskManager.h"
|
|
14 #include "Func.h"
|
|
15 #include "property.h"
|
|
16
|
|
17 extern SpriteTable sptable[DEFOBJ];
|
|
18 extern TaskManager *tmanager;
|
|
19
|
|
20 CollisionPropertyPtr
|
|
21 get_property(CHARACTER *p)
|
|
22 {
|
8
|
23 CollisionPropertyPtr property = (CollisionPropertyPtr)tmanager->allocate(sizeof(CollisionProperty));
|
5
|
24
|
8
|
25 property->bomend = bomend;
|
5
|
26 property->infg_level = infg_level;
|
|
27 property->enemycount = 0;
|
|
28
|
|
29 property->jiki = jiki;
|
|
30 property->p = *p;
|
|
31 property->tlv3 = tlv3[0];
|
|
32 property->lg = lg;
|
|
33 property->infg = infg;
|
|
34
|
|
35
|
8
|
36 memcpy(property->tama_lv1, &tama_lv1, sizeof(tama1)*20);
|
5
|
37 memcpy(property->tama_lv2, &tama_lv2, sizeof(tama2)*20);
|
|
38 memcpy(property->laser_lv1, &laser_lv1, sizeof(laser)*20);
|
|
39 memcpy(property->laser_lv2, &laser_lv2, sizeof(laser)*20);
|
|
40 memcpy(property->laser_lv3, &laser_lv3, sizeof(laser)*128);
|
|
41 memcpy(property->bchar, &bchar, sizeof(bomchar)*100);
|
|
42
|
|
43 return property;
|
|
44 }
|
|
45
|
|
46 void
|
|
47 free_property(SchedTask *s, void *prop, void *chara)
|
|
48 {
|
|
49 CollisionPropertyPtr property = (CollisionPropertyPtr)prop;
|
|
50 CHARACTER *character = (CHARACTER *)chara;
|
|
51
|
8
|
52 if(bomend > property->bomend) {
|
|
53 bomend = property->bomend;
|
5
|
54 }
|
8
|
55 if(lg.stg > property->lg.stg) {
|
5
|
56 lg.stg -= 26;
|
|
57 }
|
8
|
58 infg_level = property->infg_level;
|
5
|
59 enemycount += property->enemycount;
|
|
60
|
7
|
61 jiki.bf = property->jiki.bf;
|
|
62 jiki.zanki = property->jiki.zanki;
|
|
63 jiki.muteki = property->jiki.muteki;
|
8
|
64
|
5
|
65 *character = property->p;
|
|
66 infg = property->infg;
|
|
67
|
|
68 memcpy(tama_lv1, property->tama_lv1, sizeof(tama1)*20);
|
|
69 memcpy(tama_lv2, property->tama_lv2, sizeof(tama2)*20);
|
|
70 memcpy(laser_lv1, property->laser_lv1, sizeof(laser)*20);
|
|
71 memcpy(bchar, property->bchar, sizeof(bomchar)*100);
|
|
72
|
8
|
73 free(prop);
|
5
|
74 }
|
|
75
|
|
76
|
7
|
77 CHARACTER *atari(CHARACTER *p)
|
5
|
78 {
|
|
79 int w, h, charno;
|
|
80 CollisionPropertyPtr property = get_property(p);
|
|
81
|
|
82 charno = p->charano;
|
|
83 w = sptable[charno].w;
|
|
84 h = sptable[charno].h;
|
|
85
|
|
86 HTaskPtr collision_task = tmanager->create_task(ATARI);
|
|
87
|
|
88 collision_task->set_param(0,(memaddr)w);
|
|
89 collision_task->set_param(1,(memaddr)h);
|
|
90 collision_task->set_param(2,(memaddr)enemycount);
|
8
|
91 collision_task->set_param(3,(memaddr)tama_lv1_end);
|
|
92 collision_task->set_param(4,(memaddr)tama_lv2_end);
|
|
93 collision_task->set_param(5,(memaddr)laser_lv1_end);
|
5
|
94
|
|
95 collision_task->add_inData(property, sizeof(CollisionProperty));
|
|
96 collision_task->add_outData(property, sizeof(CollisionProperty));
|
|
97 collision_task->set_post(free_property, property, p);
|
|
98
|
|
99 collision_task->set_cpu(SPE_ANY);
|
|
100 collision_task->spawn();
|
|
101
|
|
102 return p;
|
|
103 }
|