static void drawfire (void) { unsigned int i, last1, i1, i2; static int loop = 0, sloop = 0, height = 0; register unsigned char *p; height++; loop--; if (loop < 0) loop = rand () % 3, sloop++;; i1 = 1; i2 = 4 * XSIZ + 1; for (p = (char *) bitmap + XSIZ * (YSIZ + 0); p < ((unsigned char *) bitmap + XSIZ * (YSIZ + 1)); p++, i1 += 4, i2 -= 4) { last1 = rand () % min (i1, min (i2, height)); i = rand () % 6; for (; p < (unsigned char *) bitmap + XSIZ * (YSIZ + 1) && i != 0; p++, i--, i1 += 4, i2 -= 4) *p = last1, last1 += rand () % 6 - 2, *(p + XSIZ) = last1, last1 += rand () % 6 - 2; *(p + 2 * XSIZ) = last1, last1 += rand () % 6 - 2; } /* for(p=bitmap+XSIZ*YSIZ;p<bitmap+(YSIZ+2)*XSIZ;p++) { *p=rand(); } */ i = 0; firemain (); aa_renderpalette (context, palette, params, 0, 0, aa_scrwidth (context), aa_scrheight (context)); aa_flush (context); }
static void AA_ResizeHandler(aa_context *context) { aa_resize(context); local_this->hidden->x_ratio = ((double)aa_imgwidth(context)) / ((double)local_this->screen->w); local_this->hidden->y_ratio = ((double)aa_imgheight(context)) / ((double)local_this->screen->h); fastscale (local_this->hidden->buffer, aa_image(context), local_this->hidden->w, aa_imgwidth (context), local_this->hidden->h, aa_imgheight (context)); aa_renderpalette(context, local_this->hidden->palette, local_this->hidden->rparams, 0, 0, aa_scrwidth(context), aa_scrheight(context)); aa_flush(context); }
static void AA_DirectUpdate(_THIS, int numrects, SDL_Rect *rects) { int i; SDL_Rect *rect; fastscale (AA_buffer, aa_image(AA_context), AA_w, aa_imgwidth (AA_context), AA_h, aa_imgheight (AA_context)); #if 1 aa_renderpalette(AA_context, AA_palette, AA_rparams, 0, 0, aa_scrwidth(AA_context), aa_scrheight(AA_context)); #else /* Render only the rectangles in the list */ printf("Update rects : "); for ( i=0; i < numrects; ++i ) { rect = &rects[i]; printf("(%d,%d-%d,%d)", rect->x, rect->y, rect->w, rect->h); aa_renderpalette(AA_context, AA_palette, AA_rparams, rect->x * AA_x_ratio, rect->y * AA_y_ratio, rect->w * AA_x_ratio, rect->h * AA_y_ratio); } printf("\n"); #endif SDL_mutexP(AA_mutex); aa_flush(AA_context); SDL_mutexV(AA_mutex); return; }
static void aarenderer_tick(int gt, int delta) { const client_world_info_t *worldsize = infon->get_world_info(); if (!worldsize) return; const client_maptile_t *world = infon->get_world(); unsigned char *p = bitmap; int x; int y; p--; for (y = 0; y < aa_imgheight(context); y++) { for (x = 0; x < aa_imgwidth(context); x++) { int terrainx = (x - ox) / SCALE; int terrainy = (y - oy) / SCALE; p++; if (terrainx < 0 || terrainx >= worldsize->width || terrainy < 0 || terrainy >= worldsize->height) continue; const client_maptile_t *tile = &world[terrainy * worldsize->width + terrainx]; switch (tile->type) { case TILE_SOLID: *p = 90; break; case TILE_PLAIN: *p = 0; break; default: *p = 50; break; } } } infon->each_creature(draw_creature, NULL); aa_renderpalette (context, palette, params, 0, 0, aa_scrwidth (context), aa_scrheight (context)); aa_printf(context, 0, 0, AA_SPECIAL, infon->version); aa_flush(context); }