Improved youmu homing
also: + master spark sound * only one of a sound per frame * references are more efficient
This commit is contained in:
parent
363e8043c1
commit
b0dbe755f9
11 changed files with 263 additions and 104 deletions
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 677 B |
|
@ -10,17 +10,44 @@
|
|||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="25"
|
||||
height="25"
|
||||
width="27.918322"
|
||||
height="28.870831"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.1 r9760"
|
||||
sodipodi:docname="hghost.svg"
|
||||
inkscape:export-filename="/home/laochailan/src/taisei/gfx/proj/hghost.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90">
|
||||
inkscape:export-xdpi="72"
|
||||
inkscape:export-ydpi="72">
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient3913">
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3915" />
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop3917" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient3897">
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3899" />
|
||||
<stop
|
||||
id="stop3907"
|
||||
offset="0.5"
|
||||
style="stop-color:#ffffff;stop-opacity:1;" />
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop3901" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient5913">
|
||||
<stop
|
||||
|
@ -130,20 +157,13 @@
|
|||
gradientUnits="userSpaceOnUse" />
|
||||
<filter
|
||||
inkscape:collect="always"
|
||||
id="filter5795">
|
||||
id="filter5795"
|
||||
color-interpolation-filters="sRGB">
|
||||
<feGaussianBlur
|
||||
inkscape:collect="always"
|
||||
stdDeviation="0.51933123"
|
||||
id="feGaussianBlur5797" />
|
||||
</filter>
|
||||
<filter
|
||||
inkscape:collect="always"
|
||||
id="filter5809">
|
||||
<feGaussianBlur
|
||||
inkscape:collect="always"
|
||||
stdDeviation="0.37987643"
|
||||
id="feGaussianBlur5811" />
|
||||
</filter>
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5848"
|
||||
|
@ -242,17 +262,104 @@
|
|||
r="11.240635"
|
||||
gradientTransform="matrix(1,0,0,1.0256222,0,-26.643596)"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3897"
|
||||
id="linearGradient3905"
|
||||
x1="12.545443"
|
||||
y1="1003.4647"
|
||||
x2="12.30105"
|
||||
y2="1030.9181"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.080407,0,0,0.71496298,-0.65995957,284.98823)" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3913"
|
||||
id="linearGradient3919"
|
||||
x1="12.871298"
|
||||
y1="1011.3398"
|
||||
x2="13.141016"
|
||||
y2="1046.0435"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.080407,0,0,1.080407,-1.1000304,-81.503384)" />
|
||||
<filter
|
||||
inkscape:collect="always"
|
||||
id="filter3925"
|
||||
color-interpolation-filters="sRGB">
|
||||
<feGaussianBlur
|
||||
inkscape:collect="always"
|
||||
stdDeviation="0.19230272"
|
||||
id="feGaussianBlur3927" />
|
||||
</filter>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3897"
|
||||
id="linearGradient3929"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.080407,0,0,0.71496298,-0.65995957,284.98823)"
|
||||
x1="12.545443"
|
||||
y1="1003.4647"
|
||||
x2="12.30105"
|
||||
y2="1030.9181" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3913"
|
||||
id="linearGradient3931"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.080407,0,0,1.080407,-1.1000304,-81.503384)"
|
||||
x1="12.871298"
|
||||
y1="1011.3398"
|
||||
x2="13.141016"
|
||||
y2="1046.0435" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3897"
|
||||
id="linearGradient3935"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.080407,0,0,0.71496298,-0.65995957,284.98823)"
|
||||
x1="12.545443"
|
||||
y1="1003.4647"
|
||||
x2="12.30105"
|
||||
y2="1030.9181" />
|
||||
<filter
|
||||
inkscape:collect="always"
|
||||
id="filter3997"
|
||||
color-interpolation-filters="sRGB">
|
||||
<feGaussianBlur
|
||||
inkscape:collect="always"
|
||||
stdDeviation="0.73716564"
|
||||
id="feGaussianBlur3999" />
|
||||
</filter>
|
||||
<filter
|
||||
inkscape:collect="always"
|
||||
id="filter4055"
|
||||
color-interpolation-filters="sRGB">
|
||||
<feGaussianBlur
|
||||
inkscape:collect="always"
|
||||
stdDeviation="0.22004944"
|
||||
id="feGaussianBlur4057" />
|
||||
</filter>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3897"
|
||||
id="linearGradient4061"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.080407,0,0,0.71496298,-0.65995957,284.98823)"
|
||||
x1="12.545443"
|
||||
y1="1003.4647"
|
||||
x2="12.30105"
|
||||
y2="1030.9181" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
pagecolor="#000000"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="12.275374"
|
||||
inkscape:cx="-0.46413566"
|
||||
inkscape:cy="13.197942"
|
||||
inkscape:cx="-14.161973"
|
||||
inkscape:cy="-2.8559102"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
|
@ -260,7 +367,12 @@
|
|||
inkscape:window-height="1039"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="-2"
|
||||
inkscape:window-maximized="1" />
|
||||
inkscape:window-maximized="1"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
borderlayer="true" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
|
@ -277,40 +389,23 @@
|
|||
inkscape:label="Ebene 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-1027.3622)">
|
||||
transform="translate(1.372987,-1000.9203)">
|
||||
<path
|
||||
style="fill:url(#radialGradient5925);fill-opacity:1;stroke:none;filter:url(#filter5795)"
|
||||
d="m 8.8997696,1029.58 -2.3617512,14.2281 13.8824886,-11.0599 2.073733,12.2696 -7.949309,-12.3848 -1.958525,-3.053 -6.336406,7.9493 -3.7442396,4.3203 8.5253456,-1.0368 -0.115207,9.3317 6.163594,-7.7764 2.764977,4.493 -13.59447,0.5184 -0.057604,-14.9194 7.661291,3.341 4.723502,-4.4931 -0.230414,10.0807 3.91705,-4.6083 -0.691244,8.5253 -12.7304154,-8.5829 z"
|
||||
id="path5769"
|
||||
inkscape:export-ydpi="72"
|
||||
inkscape:export-xdpi="72"
|
||||
sodipodi:nodetypes="ccc"
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:export-filename="/home/laochailan/src/taisei/gfx/proj/path5799.png"
|
||||
inkscape:export-xdpi="39.740261"
|
||||
inkscape:export-ydpi="39.740261" />
|
||||
id="path4001"
|
||||
d="m 0.39621056,1022.3195 c 1.14451494,-21.8721 21.27088444,-30.14927 24.37992744,0 -11.101153,-17.5661 -17.6427792,-8.9136 -24.37992744,0 z"
|
||||
style="opacity:0.50375941;fill:url(#linearGradient3935);fill-opacity:1;stroke:none;filter:url(#filter4055)" />
|
||||
<path
|
||||
style="fill:url(#radialGradient5919);fill-opacity:1;stroke:none;filter:url(#filter5795)"
|
||||
d="M 8.640553,2.0737327 6.2788018,16.301843 20.16129,5.2419355 22.235023,17.511521 14.285714,5.1267281 12.327189,2.0737327 5.9907834,10.023041 2.2465438,14.343318 10.771889,13.306452 10.656682,22.638249 16.820276,14.861751 19.585253,19.354839 5.9907834,19.873272 5.9331797,4.9539171 13.59447,8.2949309 18.317972,3.8018433 18.087558,13.882488 22.004608,9.2741936 21.313364,17.799539 8.5829493,9.2165899 z"
|
||||
id="path5801"
|
||||
style="opacity:0.50375941;fill:url(#linearGradient4061);fill-opacity:1;stroke:none;filter:url(#filter3997)"
|
||||
d="m 0.39621056,1022.3195 c 1.14451494,-21.8721 21.27088444,-30.14927 24.37992744,0 -11.101153,-17.5661 -17.6427792,-8.9136 -24.37992744,0 z"
|
||||
id="path3125"
|
||||
inkscape:connector-curvature="0"
|
||||
transform="matrix(0,-1,-1,0,24.855991,1052.103)"
|
||||
inkscape:export-filename="/home/laochailan/src/taisei/gfx/proj/path5799.png"
|
||||
inkscape:export-xdpi="39.740261"
|
||||
inkscape:export-ydpi="39.740261" />
|
||||
<path
|
||||
transform="matrix(0,1,1,0,0.14400915,1027.6214)"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path5803"
|
||||
d="M 8.640553,2.0737327 6.2788018,16.301843 20.16129,5.2419355 22.235023,17.511521 14.285714,5.1267281 12.327189,2.0737327 5.9907834,10.023041 2.2465438,14.343318 10.771889,13.306452 10.656682,22.638249 16.820276,14.861751 19.585253,19.354839 5.9907834,19.873272 5.9331797,4.9539171 13.59447,8.2949309 18.317972,3.8018433 18.087558,13.882488 22.004608,9.2741936 21.313364,17.799539 8.5829493,9.2165899 z"
|
||||
style="fill:url(#radialGradient5923);fill-opacity:1;stroke:none;filter:url(#filter5795)"
|
||||
inkscape:export-filename="/home/laochailan/src/taisei/gfx/proj/path5799.png"
|
||||
inkscape:export-xdpi="39.740261"
|
||||
inkscape:export-ydpi="39.740261" />
|
||||
<path
|
||||
transform="matrix(-1,0,0,1,24.740783,1027.5062)"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path5799"
|
||||
d="M 8.640553,2.0737327 6.2788018,16.301843 20.16129,5.2419355 22.235023,17.511521 14.285714,5.1267281 12.327189,2.0737327 5.9907834,10.023041 2.2465438,14.343318 10.771889,13.306452 10.656682,22.638249 16.820276,14.861751 19.585253,19.354839 5.9907834,19.873272 5.9331797,4.9539171 13.59447,8.2949309 18.317972,3.8018433 18.087558,13.882488 22.004608,9.2741936 21.313364,17.799539 8.5829493,9.2165899 z"
|
||||
style="fill:url(#radialGradient5921);fill-opacity:1;stroke:none;filter:url(#filter5795)"
|
||||
inkscape:export-xdpi="39.740261"
|
||||
inkscape:export-ydpi="39.740261" />
|
||||
sodipodi:nodetypes="ccc"
|
||||
inkscape:export-xdpi="72"
|
||||
inkscape:export-ydpi="72"
|
||||
transform="matrix(1,0,0,1.246132,0,-246.35853)" />
|
||||
</g>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 12 KiB |
BIN
sfx/masterspark.wav
Normal file
BIN
sfx/masterspark.wav
Normal file
Binary file not shown.
31
src/list.c
31
src/list.c
|
@ -64,14 +64,23 @@ int add_ref(void *ptr) {
|
|||
int i;
|
||||
|
||||
for(i = 0; i < global.refs.count; i++) {
|
||||
if(global.refs.ptrs[i] == FREEREF) {
|
||||
global.refs.ptrs[i] = ptr;
|
||||
if(global.refs.ptrs[i].ptr == ptr) {
|
||||
global.refs.ptrs[i].refs++;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
global.refs.ptrs = realloc(global.refs.ptrs, (++global.refs.count)*sizeof(void *));
|
||||
global.refs.ptrs[global.refs.count - 1] = ptr;
|
||||
for(i = 0; i < global.refs.count; i++) {
|
||||
if(global.refs.ptrs[i].ptr == FREEREF) {
|
||||
global.refs.ptrs[i].ptr = ptr;
|
||||
global.refs.ptrs[i].refs = 1;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
global.refs.ptrs = realloc(global.refs.ptrs, (++global.refs.count)*sizeof(Reference));
|
||||
global.refs.ptrs[global.refs.count - 1].ptr = ptr;
|
||||
global.refs.ptrs[global.refs.count - 1].refs = 1;
|
||||
|
||||
return global.refs.count - 1;
|
||||
}
|
||||
|
@ -80,11 +89,17 @@ void del_ref(void *ptr) {
|
|||
int i;
|
||||
|
||||
for(i = 0; i < global.refs.count; i++)
|
||||
if(global.refs.ptrs[i] == ptr)
|
||||
global.refs.ptrs[i] = NULL;
|
||||
if(global.refs.ptrs[i].ptr == ptr)
|
||||
global.refs.ptrs[i].ptr = NULL;
|
||||
}
|
||||
|
||||
void free_ref(int i) {
|
||||
if(i >= 0)
|
||||
REF(i) = FREEREF;
|
||||
if(i < 0)
|
||||
return;
|
||||
|
||||
global.refs.ptrs[i].refs--;
|
||||
if(global.refs.ptrs[i].refs <= 0) {
|
||||
global.refs.ptrs[i].ptr = FREEREF;
|
||||
global.refs.ptrs[i].refs = 0;
|
||||
}
|
||||
}
|
|
@ -17,13 +17,18 @@ void delete_element(void **dest, void *e);
|
|||
void delete_all_elements(void **dest, void (callback)(void **, void *));
|
||||
|
||||
typedef struct {
|
||||
void **ptrs;
|
||||
void *ptr;
|
||||
int refs;
|
||||
} Reference;
|
||||
|
||||
typedef struct {
|
||||
Reference *ptrs;
|
||||
int count;
|
||||
} RefArray;
|
||||
|
||||
extern void *_FREEREF;
|
||||
#define FREEREF &_FREEREF
|
||||
#define REF(p) (global.refs.ptrs[(int)p])
|
||||
#define REF(p) (global.refs.ptrs[(int)(p)].ptr)
|
||||
int add_ref(void *ptr);
|
||||
void del_ref(void *ptr);
|
||||
void free_ref(int i);
|
||||
|
|
|
@ -18,8 +18,6 @@ void YoumuOppositeMyon(Enemy *e, int t) {
|
|||
}
|
||||
|
||||
int youmu_opposite_myon(Enemy *e, int t) {
|
||||
if(t == EVENT_DEATH)
|
||||
free_ref(e->args[0]);
|
||||
if(t < 0)
|
||||
return 1;
|
||||
|
||||
|
@ -41,22 +39,29 @@ int youmu_opposite_myon(Enemy *e, int t) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int youmu_homing(Projectile *p, int t) { // a[0]: velocity, a[1]: target, a[2]: old velocity
|
||||
p->angle = rand();
|
||||
if(t == EVENT_DEATH)
|
||||
free_ref(p->args[1]);
|
||||
|
||||
|
||||
complex tv = p->args[2];
|
||||
if(REF(p->args[1]) != NULL)
|
||||
tv = cexp(I*carg(((Enemy *)REF(p->args[1]))->pos - p->pos));
|
||||
|
||||
int youmu_homing(Projectile *p, int t) { // a[0]: velocity, a[1]: target
|
||||
if(t == EVENT_DEATH) {
|
||||
// free_ref(p->args[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
p->args[2] = tv;
|
||||
Enemy *target;
|
||||
|
||||
p->pos += p->args[0]*log(t + 1) + tv*t*t/300.0;
|
||||
p->pos0 = p->pos;
|
||||
if((target = REF(p->args[1]))) {
|
||||
p->args[0] += 0.15*cexp(I*carg(target->pos - p->pos));
|
||||
} else {
|
||||
free_ref(p->args[1]);
|
||||
|
||||
if(global.enemies)
|
||||
p->args[1] = add_ref(global.enemies);
|
||||
if(global.boss)
|
||||
p->args[1] = add_ref(global.boss);
|
||||
}
|
||||
|
||||
p->angle = carg(p->args[0]);
|
||||
|
||||
p->pos += p->args[0];
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -64,28 +69,33 @@ void youmu_shot(Player *plr) {
|
|||
if(plr->fire) {
|
||||
if(!(global.frames % 4)) {
|
||||
create_projectile1c("youmu", plr->pos + 10 - I*20, NULL, linear, -20I)->type = PlrProj;
|
||||
create_projectile1c("youmu", plr->pos - 10 - I*20, NULL, linear, -20I)->type = PlrProj;
|
||||
|
||||
if(plr->power >= 2) {
|
||||
float a = 0.20;
|
||||
if(plr->focus > 0) a = 0.06;
|
||||
create_projectile1c("youmu", plr->pos - 10 - I*20, NULL, linear, -20I*cexp(-I*a))->type = PlrProj;
|
||||
create_projectile1c("youmu", plr->pos + 10 - I*20, NULL, linear, -20I*cexp(I*a))->type = PlrProj;
|
||||
}
|
||||
create_projectile1c("youmu", plr->pos - 10 - I*20, NULL, linear, -20I)->type = PlrProj;
|
||||
}
|
||||
|
||||
float a = 1;
|
||||
if(plr->focus > 0)
|
||||
a = 0.4;
|
||||
if(plr->shot == YoumuHoming && !(global.frames % 7)) {
|
||||
complex ref = -1;
|
||||
if(global.boss != NULL)
|
||||
ref = add_ref(global.boss);
|
||||
else if(global.enemies != NULL)
|
||||
ref = add_ref(global.enemies);
|
||||
if(plr->shot == YoumuHoming) {
|
||||
if(plr->focus && !(global.frames % 12-(int)plr->power)*1.5) {
|
||||
int ref = -1;
|
||||
if(global.boss != NULL)
|
||||
ref = add_ref(global.boss);
|
||||
else if(global.enemies != NULL)
|
||||
ref = add_ref(global.enemies);
|
||||
if(ref == -1)
|
||||
ref = add_ref(NULL);
|
||||
create_projectile2c("hghost", plr->pos, NULL, youmu_homing, 5*cexp(I*sin(global.frames/10.0))/I, ref)->type = PlrProj;
|
||||
create_projectile2c("hghost", plr->pos, NULL, youmu_homing, 5*cexp(I*-sin(global.frames/10.0))/I, ref)->type = PlrProj;
|
||||
}
|
||||
|
||||
if(ref != -1)
|
||||
create_projectile2c("hghost", plr->pos, NULL, youmu_homing, a*cexp(I*rand()), ref)->type = PlrProj;
|
||||
if(!plr->focus && !(global.frames % 8-(int)plr->power)) {
|
||||
float arg = -M_PI/2;
|
||||
if(global.enemies)
|
||||
arg = carg(global.enemies->pos - plr->pos);
|
||||
if(global.boss)
|
||||
arg = carg(global.boss->pos - plr->pos);
|
||||
|
||||
create_projectile2c("hghost", plr->pos, NULL, accelerated, 10*cexp((arg-0.2)*I), 0.4*cexp((arg-0.2)*I))->type = PlrProj;
|
||||
create_projectile2c("hghost", plr->pos, NULL, accelerated, 10*cexp(arg*I), 0.4*cexp(arg*I))->type = PlrProj;
|
||||
create_projectile2c("hghost", plr->pos, NULL, accelerated, 10*cexp((arg+0.2)*I), 0.4*cexp((arg+0.2)*I))->type = PlrProj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,13 +171,15 @@ void MariLaserSlave(Enemy *e, int t) {
|
|||
|
||||
// Laser sign bomb (implemented as Enemy)
|
||||
|
||||
static void draw_masterspark_ring(complex base, int t) {
|
||||
static void draw_masterspark_ring(complex base, int t, float fade) {
|
||||
glPushMatrix();
|
||||
|
||||
glTranslatef(creal(base), cimag(base)-t*t*0.2, 0);
|
||||
glTranslatef(creal(base), cimag(base)-t*t*0.4, 0);
|
||||
|
||||
float f = sqrt(t/500.0)*1200;
|
||||
|
||||
glColor4f(1,1,1,fade*20.0/t);
|
||||
|
||||
Texture *tex = get_tex("masterspark_ring");
|
||||
glScalef(f/tex->w, 1-tex->h/f,0);
|
||||
draw_texture_p(0,0,tex);
|
||||
|
@ -198,10 +210,10 @@ void MasterSpark(Enemy *e, int t) {
|
|||
draw_texture(0, -450, "masterspark");
|
||||
glPopMatrix();
|
||||
|
||||
glColor4f(0.9,1,1,fade*0.8);
|
||||
// glColor4f(0.9,1,1,fade*0.8);
|
||||
int i;
|
||||
for(i = 0; i < 8; i++)
|
||||
draw_masterspark_ring(global.plr.pos - 50I, t%30 + 15*i);
|
||||
draw_masterspark_ring(global.plr.pos - 50I, t%20 + 10*i, fade);
|
||||
|
||||
glColor4f(1,1,1,1);
|
||||
}
|
||||
|
@ -257,6 +269,7 @@ void marisa_shot(Player *plr) {
|
|||
void marisa_bomb(Player *plr) {
|
||||
switch(plr->shot) {
|
||||
case MarisaLaser:
|
||||
play_sound("masterspark");
|
||||
create_enemy_p(&plr->slaves, 40I, ENEMY_BOMB, MasterSpark, master_spark, 280,0,0,0);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -130,7 +130,7 @@ void process_projectiles(Projectile **projs, char collision) {
|
|||
create_particle1c("flare", proj->pos, NULL, Fade, timeout, 30);
|
||||
create_item(proj->pos, 0, BPoint)->auto_collect = 10;
|
||||
}
|
||||
|
||||
|
||||
if(collision)
|
||||
col = collision_projectile(proj);
|
||||
|
||||
|
@ -160,7 +160,9 @@ void process_projectiles(Projectile **projs, char collision) {
|
|||
}
|
||||
|
||||
|
||||
int linear(Projectile *p, int t) { // sure is physics in here; a[0]: velocity
|
||||
int linear(Projectile *p, int t) { // sure is physics in here; a[0]: velocity
|
||||
if(t < 0)
|
||||
return 1;
|
||||
p->angle = carg(p->args[0]);
|
||||
p->pos = p->pos0 + p->args[0]*t;
|
||||
|
||||
|
@ -168,6 +170,8 @@ int linear(Projectile *p, int t) { // sure is physics in here; a[0]: velocity
|
|||
}
|
||||
|
||||
int accelerated(Projectile *p, int t) {
|
||||
if(t < 0)
|
||||
return 1;
|
||||
p->angle = carg(p->args[0]);
|
||||
p->pos = p->pos0 + p->args[0]*t + p->args[1]*t*t;
|
||||
|
||||
|
@ -175,6 +179,8 @@ int accelerated(Projectile *p, int t) {
|
|||
}
|
||||
|
||||
int asymptotic(Projectile *p, int t) { // v = a[0]*(a[1] + 1); a[1] -> 0
|
||||
if(t < 0)
|
||||
return 1;
|
||||
p->angle = carg(p->args[0] + p->args[1]);
|
||||
|
||||
p->args[1] *= 0.8;
|
||||
|
@ -248,6 +254,18 @@ void Shrink(Projectile *p, int t) {
|
|||
glRotatef(p->angle*180/M_PI+90, 0, 0, 1);
|
||||
glScalef(s, s, 1);
|
||||
|
||||
if(cabs(p->pos) < 10) {
|
||||
printf("Hey! %d t:%d [", (int)p->args[1], t);
|
||||
int i;
|
||||
for(i = 0; i < global.refs.count; i++) {
|
||||
if(global.refs.ptrs[i].ptr == FREEREF)
|
||||
printf("%02d:FREE,",i);
|
||||
else
|
||||
printf("%02d:0x%x*%d,",i, (int)global.refs.ptrs[i].ptr,global.refs.ptrs[i].refs);
|
||||
}
|
||||
printf("\b]\n");
|
||||
}
|
||||
|
||||
_ProjDraw(p, t);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
@ -258,7 +276,7 @@ void DeathShrink(Projectile *p, int t) {
|
|||
glTranslatef(creal(p->pos), cimag(p->pos), 0);
|
||||
glRotatef(p->angle*180/M_PI+90, 0, 0, 1);
|
||||
glScalef(s, 1, 1);
|
||||
|
||||
|
||||
_ProjDraw(p, t);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
@ -281,10 +299,14 @@ void GrowFade(Projectile *p, int t) {
|
|||
}
|
||||
|
||||
int bullet_flare_move(Projectile *p, int t) {
|
||||
if(t > 16 || REF(p->args[1]) == NULL) {
|
||||
free_ref(p->args[1]);
|
||||
if(t >= creal(p->args[0]) || REF(p->args[1]) == NULL) {
|
||||
return ACTION_DESTROY;
|
||||
}
|
||||
} if(t == EVENT_DEATH) {
|
||||
free_ref(p->args[1]);
|
||||
return 1;
|
||||
} else if(t < 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
p->pos = ((Projectile *) REF(p->args[1]))->pos;
|
||||
p->angle = ((Projectile *) REF(p->args[1]))->angle;
|
||||
|
@ -308,6 +330,8 @@ int timeout(Projectile *p, int t) {
|
|||
int timeout_linear(Projectile *p, int t) {
|
||||
if(t >= creal(p->args[0]))
|
||||
return ACTION_DESTROY;
|
||||
if(t < 0)
|
||||
return 1;
|
||||
|
||||
p->angle = carg(p->args[1]);
|
||||
p->pos = p->pos0 + p->args[1]*t;
|
||||
|
|
|
@ -52,9 +52,11 @@ void play_sound(char *name) {
|
|||
}
|
||||
|
||||
void play_sound_p(Sound *snd) {
|
||||
if(tconfig.intval[NO_AUDIO])
|
||||
if(tconfig.intval[NO_AUDIO] || snd->lastplayframe == global.frames)
|
||||
return;
|
||||
|
||||
snd->lastplayframe = global.frames;
|
||||
|
||||
ALuint i,res = -1;
|
||||
ALint play;
|
||||
for(i = 0; i < SNDSRC_COUNT; i++) {
|
||||
|
|
|
@ -16,6 +16,8 @@ typedef struct Sound {
|
|||
struct Sound *next;
|
||||
struct Sound *prev;
|
||||
|
||||
int lastplayframe;
|
||||
|
||||
ALuint alsnd;
|
||||
char *name;
|
||||
} Sound;
|
||||
|
|
|
@ -242,6 +242,7 @@ void stage_logic() {
|
|||
global.timer++;
|
||||
|
||||
calc_fps(&global.fps);
|
||||
|
||||
}
|
||||
|
||||
void stage_end() {
|
||||
|
|
|
@ -203,6 +203,8 @@ int stage0_enemy3(Enemy *e, int t) {
|
|||
spawn_items(e->pos, 2,1,0,0);
|
||||
return 1;
|
||||
}
|
||||
if(t < 0)
|
||||
return 1;
|
||||
|
||||
e->pos = e->pos0 + e->args[0]*t + e->args[1]*t*t;
|
||||
|
||||
|
|
Loading…
Reference in a new issue