Turn power items into point items when their logic is processed, not when they are drawn.
See previous commit as for why. Note that this slightly changes the processing order, unlike the previous change, so any replays recorded prior to this commit will desync. The new behaviour, however, should be slightly more correct.
This commit is contained in:
parent
125f2441e7
commit
187919cb7c
2 changed files with 11 additions and 10 deletions
12
src/item.c
12
src/item.c
|
@ -32,12 +32,8 @@ void draw_items(void) {
|
|||
for(p = global.items; p; p = p->next) {
|
||||
switch(p->type){
|
||||
case Power:
|
||||
if(global.plr.power < PLR_MAXPOWER) {
|
||||
tex = get_tex("items/power");
|
||||
break;
|
||||
}
|
||||
|
||||
p->type = Point;
|
||||
tex = get_tex("items/power");
|
||||
break;
|
||||
case Point:
|
||||
tex = get_tex("items/point");
|
||||
break;
|
||||
|
@ -80,6 +76,10 @@ void process_items(void) {
|
|||
r *= 2;
|
||||
|
||||
while(item != NULL) {
|
||||
if(item->type == Power && global.plr.power >= PLR_MAXPOWER) {
|
||||
item->type = Point;
|
||||
}
|
||||
|
||||
if(cimag(global.plr.pos) < POINT_OF_COLLECT || cabs(global.plr.pos - item->pos) < r
|
||||
|| global.frames - global.plr.recovery < 0)
|
||||
item->auto_collect = 1;
|
||||
|
|
|
@ -223,6 +223,7 @@ void draw_hud(void) {
|
|||
}
|
||||
|
||||
void stage_draw(StageInfo *info, StageRule bgdraw, ShaderRule *shaderrules, int time) {
|
||||
|
||||
if(!tconfig.intval[NO_SHADER]) {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, resources.fbg[0].fbo);
|
||||
glViewport(0,0,SCREEN_W,SCREEN_H);
|
||||
|
@ -279,13 +280,13 @@ void stage_draw(StageInfo *info, StageRule bgdraw, ShaderRule *shaderrules, int
|
|||
|
||||
player_draw(&global.plr);
|
||||
|
||||
draw_items();
|
||||
draw_items();
|
||||
draw_projectiles(global.projs);
|
||||
|
||||
|
||||
draw_projectiles(global.particles);
|
||||
draw_enemies(global.enemies);
|
||||
draw_lasers();
|
||||
|
||||
|
||||
if(global.boss)
|
||||
draw_boss(global.boss);
|
||||
|
||||
|
@ -293,7 +294,7 @@ void stage_draw(StageInfo *info, StageRule bgdraw, ShaderRule *shaderrules, int
|
|||
draw_dialog(global.dialog);
|
||||
|
||||
draw_stage_title(info);
|
||||
|
||||
|
||||
if(!tconfig.intval[NO_SHADER]) {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
video_set_viewport();
|
||||
|
|
Loading…
Reference in a new issue