void actor_update(Actor *p) { static int time = 0; int looplim = animSprites[p->state]; if(p->rebirth && p->crack) { looplim = animSprites[egg]; p->animate = 1; } if(SDL_GetTicks() - time > 400 && p->animate){ time = SDL_GetTicks(); p->activeSprite++; if(p->activeSprite>looplim){ p->activeSprite = 1; if(p->rebirth){p->rebirth = 0; p->crack = 0;} } } if(!p->animate) p->activeSprite = 0; p->animate = 0; SDL_FillRect(rotbuf, 0, 0); SDL_Surface *src; if (SDL_MUSTLOCK(rotbuf)) SDL_LockSurface(rotbuf); if(p->rebirth) src = sprite_get(egg)[p->activeSprite]; else src = sprite_get(p->state)[p->activeSprite]; if (SDL_MUSTLOCK(src)) SDL_LockSurface(src); matrix_rotateImage(src, rotbuf, planet_getSlope(TOP - angle) + angle, p->left); if (SDL_MUSTLOCK(src)) SDL_UnlockSurface(src); if (SDL_MUSTLOCK(rotbuf)) SDL_UnlockSurface(rotbuf); if(p->life <= 0) actor_kill(p); p->life--; }
int main_sprtplte_callback(int msg, DIALOG * d, int ic) { static int last_mb; struct sprite_palette **spmp; struct sprite_palette *spm; spmp = d->dp; spm = *spmp; spm->last_selected = ic; if(msg == MSG_DCLICK) { if ((last_mb&3) == (mouse_b&3)) { // make sure it's the same mouse button for a double-click if (last_mb & 2) // right clicked sprite_put(ic, current_sprite, spm); // right d-click -> replace else sprite_get(ic, current_sprite, spm); // left d-click -> grab return(D_REDRAW); } } else { last_mb = mouse_b; } return(D_O_K); }
int main_sprtplte_callback(DIALOG * d, int ic) { struct sprite_palette **spmp; struct sprite_palette *spm; spmp = d->dp; spm = *spmp; sprite_edit_function = SEF_NOTHING; sprintf(sprite_popup[0].text, "Sprite 0x%03x", ic); // try to center the popup menu on the cursor... do_menu(sprite_popup, mouse_x-56, mouse_y-50); switch (sprite_edit_function) { case (SEF_EDIT): // get sprite_get(ic, current_sprite, spm); spm->last_selected = ic; return D_REDRAW; break; case (SEF_REPLACE): // put sprite_put(ic, current_sprite, spm); spm->last_selected = ic; // redundant return D_REDRAW; break; case (SEF_NOTHING): default: break; } return(D_O_K); }
int sprite_capture(DIALOG *d) { if (GameDriverLoaded == FALSE || GfxBanks == NULL) return D_O_K; if (GfxBanks[currentGfxBank].last_selected >= 0) sprite_get(GfxBanks[currentGfxBank].last_selected, current_sprite, &GfxBanks[currentGfxBank]); return D_REDRAW; }
t_sprite sprite_at(t_map* map, int x, int y) { return sprite_get(map->tilesets[y].tiles[x]); }