comparison collision_task.cc @ 8:e90c4a8f9dc8

fix.
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Thu, 16 Dec 2010 01:15:03 +0900
parents 23d54565aa7b
children 00c3272a801f
comparison
equal deleted inserted replaced
7:23d54565aa7b 8:e90c4a8f9dc8
18 extern TaskManager *tmanager; 18 extern TaskManager *tmanager;
19 19
20 CollisionPropertyPtr 20 CollisionPropertyPtr
21 get_property(CHARACTER *p) 21 get_property(CHARACTER *p)
22 { 22 {
23 CollisionPropertyPtr property = new(CollisionProperty); 23 CollisionPropertyPtr property = (CollisionPropertyPtr)tmanager->allocate(sizeof(CollisionProperty));
24 24
25 property->bomend = bomend;
25 property->infg_level = infg_level; 26 property->infg_level = infg_level;
26 property->enemycount = 0; 27 property->enemycount = 0;
27 28
28 property->jiki = jiki; 29 property->jiki = jiki;
29 property->p = *p; 30 property->p = *p;
30 property->tlv3 = tlv3[0]; 31 property->tlv3 = tlv3[0];
31 property->lg = lg; 32 property->lg = lg;
32 property->infg = infg; 33 property->infg = infg;
33 34
34 35
35 memcpy(property->tama_lv1, &tama_lv1, sizeof(tama1)*20); 36 memcpy(property->tama_lv1, &tama_lv1, sizeof(tama1)*20);
36 memcpy(property->tama_lv2, &tama_lv2, sizeof(tama2)*20); 37 memcpy(property->tama_lv2, &tama_lv2, sizeof(tama2)*20);
37 memcpy(property->laser_lv1, &laser_lv1, sizeof(laser)*20); 38 memcpy(property->laser_lv1, &laser_lv1, sizeof(laser)*20);
38 memcpy(property->laser_lv2, &laser_lv2, sizeof(laser)*20); 39 memcpy(property->laser_lv2, &laser_lv2, sizeof(laser)*20);
39 memcpy(property->laser_lv3, &laser_lv3, sizeof(laser)*128); 40 memcpy(property->laser_lv3, &laser_lv3, sizeof(laser)*128);
40 memcpy(property->bchar, &bchar, sizeof(bomchar)*100); 41 memcpy(property->bchar, &bchar, sizeof(bomchar)*100);
46 free_property(SchedTask *s, void *prop, void *chara) 47 free_property(SchedTask *s, void *prop, void *chara)
47 { 48 {
48 CollisionPropertyPtr property = (CollisionPropertyPtr)prop; 49 CollisionPropertyPtr property = (CollisionPropertyPtr)prop;
49 CHARACTER *character = (CHARACTER *)chara; 50 CHARACTER *character = (CHARACTER *)chara;
50 51
51 if(infg_level <= property->infg_level||infg_level != 0) { 52 if(bomend > property->bomend) {
52 infg_level--; 53 bomend = property->bomend;
53 } 54 }
54 if(lg.stg <= property->lg.stg) { 55 if(lg.stg > property->lg.stg) {
55 lg.stg -= 26; 56 lg.stg -= 26;
56 } 57 }
58 infg_level = property->infg_level;
57 enemycount += property->enemycount; 59 enemycount += property->enemycount;
58 60
59 jiki.bf = property->jiki.bf; 61 jiki.bf = property->jiki.bf;
60 jiki.zanki = property->jiki.zanki; 62 jiki.zanki = property->jiki.zanki;
61 jiki.muteki = property->jiki.muteki; 63 jiki.muteki = property->jiki.muteki;
64
62 *character = property->p; 65 *character = property->p;
63 tlv3[0] = property->tlv3;
64 infg = property->infg; 66 infg = property->infg;
65 67
66 memcpy(tama_lv1, property->tama_lv1, sizeof(tama1)*20); 68 memcpy(tama_lv1, property->tama_lv1, sizeof(tama1)*20);
67 memcpy(tama_lv2, property->tama_lv2, sizeof(tama2)*20); 69 memcpy(tama_lv2, property->tama_lv2, sizeof(tama2)*20);
68 memcpy(laser_lv1, property->laser_lv1, sizeof(laser)*20); 70 memcpy(laser_lv1, property->laser_lv1, sizeof(laser)*20);
69 memcpy(laser_lv2, property->laser_lv2, sizeof(laser)*20);
70 memcpy(laser_lv3, property->laser_lv3, sizeof(laser)*128);
71 memcpy(bchar, property->bchar, sizeof(bomchar)*100); 71 memcpy(bchar, property->bchar, sizeof(bomchar)*100);
72 72
73 delete property; 73 free(prop);
74 } 74 }
75 75
76 76
77 CHARACTER *atari(CHARACTER *p) 77 CHARACTER *atari(CHARACTER *p)
78 { 78 {
86 HTaskPtr collision_task = tmanager->create_task(ATARI); 86 HTaskPtr collision_task = tmanager->create_task(ATARI);
87 87
88 collision_task->set_param(0,(memaddr)w); 88 collision_task->set_param(0,(memaddr)w);
89 collision_task->set_param(1,(memaddr)h); 89 collision_task->set_param(1,(memaddr)h);
90 collision_task->set_param(2,(memaddr)enemycount); 90 collision_task->set_param(2,(memaddr)enemycount);
91 collision_task->set_param(3,(memaddr)bomend); 91 collision_task->set_param(3,(memaddr)tama_lv1_end);
92 collision_task->set_param(4,(memaddr)tama_lv1_end); 92 collision_task->set_param(4,(memaddr)tama_lv2_end);
93 collision_task->set_param(5,(memaddr)tama_lv2_end); 93 collision_task->set_param(5,(memaddr)laser_lv1_end);
94 collision_task->set_param(6,(memaddr)laser_lv1_end);
95 collision_task->set_param(7,(memaddr)infg_level);
96 94
97 collision_task->add_inData(property, sizeof(CollisionProperty)); 95 collision_task->add_inData(property, sizeof(CollisionProperty));
98 collision_task->add_outData(property, sizeof(CollisionProperty)); 96 collision_task->add_outData(property, sizeof(CollisionProperty));
99 collision_task->set_post(free_property, property, p); 97 collision_task->set_post(free_property, property, p);
100 98