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_return(DIALOG *d) { if (GameDriverLoaded == FALSE || GfxBanks == NULL) return D_O_K; if (GfxBanks[currentGfxBank].last_selected >= 0) sprite_put(GfxBanks[currentGfxBank].last_selected, current_sprite, &GfxBanks[currentGfxBank]); return D_REDRAW; }
static void process_stars(star *stars) { for (int i = 0; i < NUM_STARS; i++) { stars[i].x = stars[i].x + stars[i].speed; if (stars[i].x >= 320) { stars[i].x = 0; stars[i].y = GET_HVCOUNTER%256; } sprite_put(stars[i].x, stars[i].y, SPRITE_SIZE(1,1), stars[i].size); } }