Changeset 709
- Timestamp:
- Aug 17, 2013, 12:01:38 PM (9 years ago)
- Location:
- abuse/branches/lol/src
- Files:
-
- 71 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/branches/lol/src/ant.cpp
r695 r709 441 441 442 442 443 void fade_in( image *im, int steps);443 void fade_in(AImage *im, int steps); 444 444 void fade_out(int steps); 445 445 … … 451 451 wm->SetMousePos(ivec2(0, 0)); 452 452 main_screen->clear(); 453 image *im=cache.img(cache.reg("art/frame.spe","end_level_screen",SPEC_IMAGE,1));453 AImage *im=cache.img(cache.reg("art/frame.spe","end_level_screen",SPEC_IMAGE,1)); 454 454 main_screen->PutImage(im, ivec2(0, 0)); 455 455 -
abuse/branches/lol/src/automap.cpp
r691 r709 23 23 { 24 24 if (!automap_window) return ; 25 image *screen=automap_window->m_surf;25 AImage *screen=automap_window->m_surf; 26 26 27 27 long sx,ex,sy,ey,x,y,window_xstart,window_ystart, … … 63 63 if (draw_xstart==old_dx && draw_ystart==old_dy) 64 64 { 65 automap_window->m_surf->Lock();66 65 automap_window->m_surf->AddDirty(center, center + ivec2(1)); 67 66 if ((tick++)&4) … … 69 68 else 70 69 automap_window->m_surf->PutPixel(center, 27); 71 automap_window->m_surf->Unlock();72 70 return ; 73 71 } … … 141 139 // draw the person as a dot, no need to add a dirty because we marked the 142 140 // whole screen already 143 automap_window->m_surf->Lock();144 141 if ((tick++)&4) 145 142 automap_window->m_surf->PutPixel(center, 255); 146 143 else 147 144 automap_window->m_surf->PutPixel(center, 27); 148 automap_window->m_surf->Unlock();149 145 150 146 // set the clip back to full window size because soemthing else could mess with the area -
abuse/branches/lol/src/cache.cpp
r700 r709 199 199 case SPEC_FORETILE : delete ((foretile *)i->data); break; 200 200 case SPEC_BACKTILE : delete ((backtile *)i->data); break; 201 case SPEC_IMAGE : delete (( image *)i->data); break;201 case SPEC_IMAGE : delete ((AImage *)i->data); break; 202 202 case SPEC_EXTERN_SFX : delete ((sound_effect *)i->data); break; 203 203 case SPEC_PARTICLE : delete ((part_frame *)i->data); break; … … 977 977 } 978 978 979 image *CacheList::img(int id)979 AImage *CacheList::img(int id) 980 980 { 981 981 CacheItem *me = list + id; … … 986 986 { 987 987 touch(me); 988 return ( image *)me->data;988 return (AImage *)me->data; 989 989 } 990 990 else … … 992 992 touch(me); // hold me, feel me, be me! 993 993 locate(me); 994 image *im=new image(fp);994 AImage *im=new AImage(fp); 995 995 me->data=(void *)im; 996 996 last_offset=fp->tell(); 997 997 998 return ( image *)me->data;998 return (AImage *)me->data; 999 999 } 1000 1000 } -
abuse/branches/lol/src/cache.h
r691 r709 117 117 foretile *foret(int id); 118 118 figure *fig(int id); 119 image *img(int id);119 AImage *img(int id); 120 120 part_frame *part(int id); 121 121 sound_effect *sfx(int id); -
abuse/branches/lol/src/cop.cpp
r708 r709 1021 1021 1022 1022 1023 extern void fade_in( image *im, int steps);1023 extern void fade_in(AImage *im, int steps); 1024 1024 extern void fade_out(int steps); 1025 1025 … … 1029 1029 wm->SetMousePos(ivec2(0, 0)); 1030 1030 main_screen->clear(); 1031 image *im=cache.img(cache.reg("art/frame.spe","end_level_screen",SPEC_IMAGE,1));1031 AImage *im=cache.img(cache.reg("art/frame.spe","end_level_screen",SPEC_IMAGE,1)); 1032 1032 main_screen->PutImage(im, ivec2(0, 0)); 1033 1033 int x1=im->Size().x+1,y1=0,y2=main_screen->Size().y; -
abuse/branches/lol/src/demo.cpp
r707 r709 35 35 extern void net_receive(); 36 36 extern void net_send(int force); 37 extern void fade_in( image *im, int steps);37 extern void fade_in(AImage *im, int steps); 38 38 extern void fade_out(int steps); 39 39 -
abuse/branches/lol/src/dev.cpp
r708 r709 104 104 public : 105 105 cached_image(int Id) { id=Id; } 106 virtual void draw( image *screen, int x, int y, Filter *f)106 virtual void draw(AImage *screen, int x, int y, Filter *f) 107 107 { 108 108 if (f) … … 144 144 amb_cont(int X, int Y, ifield *Next) : scroller(X,Y,ID_NULL,100,wm->font()->Size().y+2,0,64,Next) 145 145 { if (player_list) sx=player_list->ambient; } 146 virtual void scroll_event(int newx, image *screen)146 virtual void scroll_event(int newx, AImage *screen) 147 147 { 148 148 screen->Bar(m_pos, m_pos + ivec2(l - 1, h - 1), wm->dark_color()); … … 160 160 { 161 161 Jwindow *quitw; 162 image *ok_image, *cancel_image;162 AImage *ok_image, *cancel_image; 163 163 164 164 ok_image = cache.img(cache.reg("art/frame.spe", "dev_ok", … … 351 351 } 352 352 353 void scale_put( image *im, image *screen, int x, int y, short new_width, short new_height)353 void scale_put(AImage *im, AImage *screen, int x, int y, short new_width, short new_height) 354 354 { 355 355 unsigned char *sl1,*sl2; … … 378 378 new_height-=y+new_height-cbb.y; 379 379 380 screen->Lock();381 im->Lock();382 380 for (iy=iy_start; new_height>0; new_height--,y++,iy+=ystep) 383 381 { … … 387 385 *sl2=sl1[ix>>16]; 388 386 } 389 im->Unlock(); 390 screen->Unlock(); 391 } 392 393 394 void scale_put_trans(image *im, image *screen, int x, int y, short new_width, short new_height) 387 } 388 389 390 void scale_put_trans(AImage *im, AImage *screen, int x, int y, short new_width, short new_height) 395 391 { 396 392 unsigned char *sl1,*sl2; … … 420 416 421 417 uint8_t d; 422 screen->Lock();423 418 for (iy=iy_start; new_height>0; new_height--,y++,iy+=ystep) 424 419 { … … 432 427 } 433 428 } 434 screen->Unlock();435 429 } 436 430 … … 468 462 && f->m_pos.y - dv.y <= (v->m_bb.y - v->m_aa.y + 1)) 469 463 { 470 image *im = cache.img(light_buttons[f->m_type]);464 AImage *im = cache.img(light_buttons[f->m_type]); 471 465 main_screen->PutImage(im, f->m_pos - dv + v->m_aa - im->Size() / 2); 472 466 main_screen->Rectangle(f->m_p1 - dv + v->m_aa, f->m_p2 - dv + v->m_aa, … … 484 478 if (selected_light) 485 479 { 486 image *im = cache.img(light_buttons[0]);480 AImage *im = cache.img(light_buttons[0]); 487 481 ivec2 pos = the_game->GameToMouse(selected_light->m_pos, v); 488 482 main_screen->Rectangle(pos - im->Size() / 2, pos + im->Size() / 2, … … 541 535 static LightSource *find_light(int32_t x, int32_t y) 542 536 { 543 image *i = cache.img(light_buttons[0]);537 AImage *i = cache.img(light_buttons[0]); 544 538 int l = i->Size().x / 2, h = i->Size().y / 2; 545 539 for (LightSource *f = first_light_source; f; f = f->m_next) … … 2931 2925 { 2932 2926 me->clear(); 2933 image *im=new image(ivec2(the_game->ftile_width(),the_game->ftile_height()));2927 AImage *im=new AImage(ivec2(the_game->ftile_width(),the_game->ftile_height())); 2934 2928 int th=the_game->ftile_height()/scale,tw=the_game->ftile_width()/scale; 2935 2929 -
abuse/branches/lol/src/devsel.cpp
r682 r709 20 20 #include "game.h" 21 21 22 void scale_put( image *im, image *screen, int x, int y, short new_width, short new_height);23 void scale_put_trans( image *im, image *screen, int x, int y, short new_width, short new_height);22 void scale_put(AImage *im, AImage *screen, int x, int y, short new_width, short new_height); 23 void scale_put_trans(AImage *im, AImage *screen, int x, int y, short new_width, short new_height); 24 24 int cur_bg=0,cur_fg=0,cur_char=0; 25 25 26 void tile_picker::recenter( image *screen)26 void tile_picker::recenter(AImage *screen) 27 27 { 28 28 set_x(get_current(), screen); … … 91 91 92 92 93 void tile_picker::scroll_event(int newx, image *screen)93 void tile_picker::scroll_event(int newx, AImage *screen) 94 94 { 95 95 int ya = pich(), xw = picw(), c = get_current(); 96 image im(ivec2(xw, ya));96 AImage im(ivec2(xw, ya)); 97 97 last_sel=newx; 98 98 … … 147 147 148 148 149 void tile_picker::handle_inside_event(Event &ev, image *screen, InputManager *inm)149 void tile_picker::handle_inside_event(Event &ev, AImage *screen, InputManager *inm) 150 150 { 151 151 if (ev.type==EV_MOUSE_BUTTON) -
abuse/branches/lol/src/devsel.h
r643 r709 19 19 tile_picker(int X, int Y, int ID, int spec_type, 20 20 int scale, int scroll_h, int Wid, ifield *Next); 21 virtual void handle_inside_event(Event &ev, image *screen, InputManager *inm);22 virtual void scroll_event(int newx, image *screen);21 virtual void handle_inside_event(Event &ev, AImage *screen, InputManager *inm); 22 virtual void scroll_event(int newx, AImage *screen); 23 23 virtual char *read() { return (char *)this; } 24 24 int picw(); … … 27 27 int get_current(); 28 28 void set_current(int x); 29 void recenter( image *screen);29 void recenter(AImage *screen); 30 30 void reverse() { rev=!rev; } 31 31 } ; -
abuse/branches/lol/src/endgame.cpp
r707 r709 43 43 extern int text_draw(int y, int x1, int y1, int x2, int y2, char const *buf, JCFont *font, uint8_t *cmap, char color); 44 44 45 static mask_line *make_mask_lines( image *mask, int map_width)45 static mask_line *make_mask_lines(AImage *mask, int map_width) 46 46 { 47 47 mask_line *p=(mask_line *)malloc(mask->Size().y*sizeof(mask_line)); … … 84 84 85 85 86 void scan_map( image *screen, int sx, int sy, image *im1, image *im2, int fade256, int32_t *paddr, mask_line *p, int mask_height,86 void scan_map(AImage *screen, int sx, int sy, AImage *im1, AImage *im2, int fade256, int32_t *paddr, mask_line *p, int mask_height, 87 87 int xoff, int coff) 88 88 { … … 131 131 132 132 133 void fade_in( image *im, int steps);133 void fade_in(AImage *im, int steps); 134 134 void fade_out(int steps); 135 135 … … 142 142 } ; 143 143 144 void scale_put ( image *im, image *screen, int x, int y, short new_width, short new_height);145 void scale_put_trans( image *im, image *screen, int x, int y, short new_width, short new_height);144 void scale_put (AImage *im, AImage *screen, int x, int y, short new_width, short new_height); 145 void scale_put_trans(AImage *im, AImage *screen, int x, int y, short new_width, short new_height); 146 146 147 147 void show_end2() … … 179 179 fade_out(16); 180 180 181 image blank(ivec2(2)); blank.clear();181 AImage blank(ivec2(2)); blank.clear(); 182 182 wm->SetMouseShape(blank.copy(), ivec2(0, 0)); // don't show mouse 183 183 … … 220 220 221 221 scan_map(main_screen,ex,ey,cache.img(planet),cache.img(planet2),0,paddr,p,cache.img(mask)->Size().y,eoff,coff); 222 image *tcopy=cache.img(planet)->copy();222 AImage *tcopy=cache.img(planet)->copy(); 223 223 fade_in(NULL,32); 224 224 … … 256 256 { 257 257 int t=i-38; 258 image *s=cache.img(ship);258 AImage *s=cache.img(ship); 259 259 int nw=s->Size().x*(t+2)/16, 260 260 nh=s->Size().y*(t+2)/16; … … 424 424 { 425 425 fade_out(16); 426 image blank(ivec2(2, 2)); blank.clear();426 AImage blank(ivec2(2, 2)); blank.clear(); 427 427 wm->SetMouseShape(blank.copy(), ivec2(0, 0)); // don't show mouse 428 428 main_screen->clear(); 429 429 430 image *im=cache.img(cache.reg("art/fore/endgame.spe","tbc",SPEC_IMAGE,1));430 AImage *im=cache.img(cache.reg("art/fore/endgame.spe","tbc",SPEC_IMAGE,1)); 431 431 432 432 void *to_be = LSymbol::FindOrCreate("to_be_continued")->GetValue(); … … 481 481 { 482 482 fade_out(16); 483 image blank(ivec2(2, 2)); blank.clear();483 AImage blank(ivec2(2, 2)); blank.clear(); 484 484 wm->SetMouseShape(blank.copy(), ivec2(0, 0)); // don't show mouse 485 485 main_screen->clear(); 486 486 487 image *im=cache.img(cache.reg("art/fore/endgame.spe","end.pcx",SPEC_IMAGE,1));487 AImage *im=cache.img(cache.reg("art/fore/endgame.spe","end.pcx",SPEC_IMAGE,1)); 488 488 489 489 int dx=(xres+1)/2-320/2,dy=(yres+1)/2-200/2; -
abuse/branches/lol/src/game.cpp
r708 r709 439 439 if(but) but = 1; 440 440 int dx = 20, dy = 5; 441 image *jim = cache.img(joy_picts[but * 9+(y + 1)*3 + x + 1]);441 AImage *jim = cache.img(joy_picts[but * 9+(y + 1)*3 + x + 1]); 442 442 joy_win->m_surf->Bar(ivec2(dx, dy), ivec2(dx + jim->Size().x + 6, 443 443 dy + jim->Size().y + 6), … … 477 477 } 478 478 479 void Game::draw_value( image *screen, int x, int y, int w, int h,479 void Game::draw_value(AImage *screen, int x, int y, int w, int h, 480 480 int val, int max) 481 481 { … … 599 599 } 600 600 601 void remap_area(image *screen, int x1, int y1, int x2, int y2, uint8_t *remap) 602 { 603 screen->Lock(); 604 601 void remap_area(AImage *screen, int x1, int y1, int x2, int y2, uint8_t *remap) 602 { 605 603 uint8_t *sl = (uint8_t *)screen->scan_line(y1) + x1; 606 604 int step = screen->Size().x - (x2 - x1 + 1); … … 615 613 sl += step; 616 614 } 617 screen->Unlock();618 615 } 619 616 … … 643 640 if(state == SCENE_STATE) 644 641 main_screen->SetClip(v->m_aa, v->m_bb + ivec2(1)); 645 image *tit = cache.img(title_screen);642 AImage *tit = cache.img(title_screen); 646 643 main_screen->PutImage(tit, main_screen->Size() / 2 - tit->Size() / 2); 647 644 if(state == SCENE_STATE) … … 663 660 { 664 661 int c = v->draw_solid; 665 main_screen->Lock();666 662 for(int y = v->m_aa.y; y <= v->m_bb.y; y++) 667 663 memset(main_screen->scan_line(y)+v->m_aa.x, c, v->m_bb.x - v->m_aa.x + 1); 668 main_screen->Unlock();669 664 v->draw_solid = -1; 670 665 return; … … 799 794 else 800 795 main_screen->clear(wm->black()); 801 main_screen->Lock();802 796 for(y = y1, draw_y = yo; y <= y2; y++, draw_y += yinc) 803 797 { … … 824 818 } 825 819 } 826 main_screen->Unlock();827 820 828 821 if(dev & EDIT_MODE) … … 1041 1034 } 1042 1035 1043 template<int N> static void Fade( image *im, int steps)1036 template<int N> static void Fade(AImage *im, int steps) 1044 1037 { 1045 1038 /* 25ms per step */ … … 1079 1072 } 1080 1073 1081 void fade_in( image *im, int steps)1074 void fade_in(AImage *im, int steps) 1082 1075 { 1083 1076 Fade<1>(im, steps); … … 1116 1109 // exit() will try to delete (through the desctructor of 1117 1110 // image_list in image.cpp) the image on the stack -> boom. 1118 image *blank = new image(ivec2(2, 2));1111 AImage *blank = new AImage(ivec2(2, 2)); 1119 1112 blank->clear(); 1120 1113 wm->SetMouseShape(blank->copy(), ivec2(0, 0)); // hide mouse … … 1135 1128 g_palette->shift(1); 1136 1129 1137 image *gray = new image(fp, sd.find("gray_pict"));1138 image *smoke[5];1130 AImage *gray = new AImage(fp, sd.find("gray_pict")); 1131 AImage *smoke[5]; 1139 1132 1140 1133 char nm[20]; … … 1142 1135 { 1143 1136 sprintf(nm, "smoke%04d.pcx", i + 1); 1144 smoke[i] = new image(fp, sd.find(nm));1137 smoke[i] = new AImage(fp, sd.find(nm)); 1145 1138 } 1146 1139 … … 1361 1354 if(title_screen >= 0) 1362 1355 { 1363 image *im = cache.img(title_screen);1356 AImage *im = cache.img(title_screen); 1364 1357 main_screen->PutImage(im, main_screen->Size() / 2 - im->Size() / 2); 1365 1358 } -
abuse/branches/lol/src/game.h
r698 r709 94 94 void step(); 95 95 void show_help(char const *st); 96 void draw_value( image *screen, int x, int y, int w, int h, int val, int max);96 void draw_value(AImage *screen, int x, int y, int w, int h, int val, int max); 97 97 unsigned char get_color(int x) { return x; } 98 98 int done(); -
abuse/branches/lol/src/gamma.cpp
r708 r709 34 34 public: 35 35 int sc; 36 virtual void draw_item( image *screen, int x, int y, int num, int active)36 virtual void draw_item(AImage *screen, int x, int y, int num, int active) 37 37 { 38 38 long x2 = x + item_width() - 1; -
abuse/branches/lol/src/gui.cpp
r707 r709 74 74 } 75 75 76 void ico_switch_button::handle_event(Event &ev, image *screen, InputManager *im)76 void ico_switch_button::handle_event(Event &ev, AImage *screen, InputManager *im) 77 77 { 78 78 if ((ev.type==EV_KEY && ev.key==13) || (ev.type==EV_MOUSE_BUTTON && … … 87 87 } 88 88 89 void ico_button::draw(int active, image *screen)89 void ico_button::draw(int active, AImage *screen) 90 90 { 91 91 int x1, y1, x2, y2; … … 119 119 extern int sfx_volume; 120 120 121 void ico_button::handle_event(Event &ev, image *screen, InputManager *im)121 void ico_button::handle_event(Event &ev, AImage *screen, InputManager *im) 122 122 { 123 123 if ((ev.type==EV_KEY && ev.key==13) || (ev.type==EV_MOUSE_BUTTON && -
abuse/branches/lol/src/gui.h
r698 r709 23 23 24 24 virtual void area(int &x1, int &y1, int &x2, int &y2); 25 virtual void draw_first( image *screen) { draw(0,screen); }26 virtual void draw(int active, image *screen);27 virtual void handle_event(Event &ev, image *screen, InputManager *im);25 virtual void draw_first(AImage *screen) { draw(0,screen); } 26 virtual void draw(int active, AImage *screen); 27 virtual void handle_event(Event &ev, AImage *screen, InputManager *im); 28 28 29 29 virtual char *read() { return (char *)&up; } … … 39 39 ico_switch_button(int X, int Y, int ID, int start_on, ifield *butts, ifield *Next); 40 40 virtual void area(int &x1, int &y1, int &x2, int &y2); 41 virtual void draw_first( image *screen) { cur_but->draw_first(screen); }42 virtual void draw(int active, image *screen) { cur_but->draw(active,screen); act=active; }43 virtual void handle_event(Event &ev, image *screen, InputManager *im);41 virtual void draw_first(AImage *screen) { cur_but->draw_first(screen); } 42 virtual void draw(int active, AImage *screen) { cur_but->draw(active,screen); act=active; } 43 virtual void handle_event(Event &ev, AImage *screen, InputManager *im); 44 44 virtual ifield *unlink(int id); 45 45 virtual char *read() { return cur_but->read(); } -
abuse/branches/lol/src/help.cpp
r682 r709 23 23 static int help_page=0; 24 24 25 void fade_in( image *im, int steps);25 void fade_in(AImage *im, int steps); 26 26 void fade_out(int steps); 27 27 28 28 void draw_help() 29 29 { 30 image *im=cache.img(help_screens[help_page]);30 AImage *im=cache.img(help_screens[help_page]); 31 31 int x1=xres/2-im->Size().x/2,y1=yres/2-im->Size().y/2; 32 32 int x2=x1+im->Size().x,y2=y1+im->Size().y; -
abuse/branches/lol/src/imlib/event.cpp
r707 r709 32 32 // Constructor 33 33 // 34 EventHandler::EventHandler( image *screen, Palette *pal)34 EventHandler::EventHandler(AImage *screen, Palette *pal) 35 35 { 36 36 ASSERT(screen); … … 58 58 f.Set(1, pal->FindBrightest(1)); 59 59 f.Set(2, pal->FindDarkest(1)); 60 image *im = new image(ivec2(8, 10), mouse_sprite); 60 AImage *im = new AImage(ivec2(8, 10)); 61 memcpy(im->scan_line(0), mouse_sprite, 8 * 10); 61 62 f.Apply(im); 62 63 … … 65 66 m_center = ivec2(0, 0); 66 67 m_button = 0; 67 68 // Platform-specific stuff69 SysInit();70 68 } 71 69 -
abuse/branches/lol/src/imlib/event.h
r707 r709 61 61 { 62 62 public: 63 EventHandler( image *screen, Palette *pal);63 EventHandler(AImage *screen, Palette *pal); 64 64 ~EventHandler(); 65 65 … … 79 79 80 80 int has_mouse() { return 1; } 81 void SetMouseShape( image *im, ivec2 center)81 void SetMouseShape(AImage *im, ivec2 center) 82 82 { 83 83 m_sprite->SetVisual(im, 1); … … 95 95 int m_pending, last_key; 96 96 97 image *m_screen;97 AImage *m_screen; 98 98 99 99 protected: -
abuse/branches/lol/src/imlib/filesel.cpp
r682 r709 32 32 virtual int item_width() { return wm->font()->Size().x * wid; } 33 33 virtual int item_height() { return wm->font()->Size().y + 1; } 34 virtual void draw_item( image *screen, int x, int y, int num, int active);35 virtual void note_selection( image *screen, InputManager *inm, int x);34 virtual void draw_item(AImage *screen, int x, int y, int num, int active); 35 virtual void note_selection(AImage *screen, InputManager *inm, int x); 36 36 void free_up(); 37 37 ~file_picker() { free_up(); } … … 49 49 } 50 50 51 void file_picker::note_selection( image *screen, InputManager *inm, int x)51 void file_picker::note_selection(AImage *screen, InputManager *inm, int x) 52 52 { 53 53 if (x<td) … … 93 93 } 94 94 95 void file_picker::draw_item( image *screen, int x, int y, int num, int active)95 void file_picker::draw_item(AImage *screen, int x, int y, int num, int active) 96 96 { 97 97 if (active) -
abuse/branches/lol/src/imlib/filter.cpp
r694 r709 57 57 } 58 58 59 void Filter::Apply( image *im)59 void Filter::Apply(AImage *im) 60 60 { 61 im->Lock();62 61 uint8_t *dst = im->scan_line(0); 63 62 int npixels = im->Size().x * im->Size().y; … … 67 66 ++dst; 68 67 } 69 im->Unlock();70 68 } 71 69 72 70 /* This is only ever used in the editor, when showing the toolbar. It 73 71 * does not look like it's very useful. */ 74 void Filter::PutImage( image *screen, image *im, ivec2 pos)72 void Filter::PutImage(AImage *screen, AImage *im, ivec2 pos) 75 73 { 76 74 ivec2 aa = ivec2(0), bb = im->Size(), caa, cbb; … … 92 90 screen->AddDirty(pos, pos + span); 93 91 94 screen->Lock();95 im->Lock();96 97 92 for (int j = 0; j < span.y; j++) 98 93 { … … 104 99 *dst = m_table[*src]; 105 100 } 106 107 im->Unlock();108 screen->Unlock();109 101 } 110 102 -
abuse/branches/lol/src/imlib/filter.h
r694 r709 25 25 void Set(int color_num, int change_to); 26 26 int GetMapping(int color_num) { return m_table[color_num]; } 27 void Apply( image *im);28 void PutImage( image *screen, image *im, ivec2 pos);27 void Apply(AImage *im); 28 void PutImage(AImage *screen, AImage *im, ivec2 pos); 29 29 30 30 private: -
abuse/branches/lol/src/imlib/fonts.cpp
r682 r709 19 19 #include "fonts.h" 20 20 21 void JCFont::PutString( image *screen, ivec2 pos, char const *st, int color)21 void JCFont::PutString(AImage *screen, ivec2 pos, char const *st, int color) 22 22 { 23 23 for ( ; *st; st++, pos.x += m_size.x) … … 25 25 } 26 26 27 void JCFont::PutChar( image *screen, ivec2 pos, char ch, int color)27 void JCFont::PutChar(AImage *screen, ivec2 pos, char ch, int color) 28 28 { 29 29 if (!m_data[(int)ch]) … … 36 36 } 37 37 38 JCFont::JCFont( image *letters)38 JCFont::JCFont(AImage *letters) 39 39 { 40 40 m_size = (letters->Size() + ivec2(1)) / ivec2(32, 8); 41 41 42 image tmp(m_size);42 AImage tmp(m_size); 43 43 44 44 for (int ch = 0; ch < 256; ch++) -
abuse/branches/lol/src/imlib/fonts.h
r682 r709 18 18 { 19 19 public: 20 JCFont( image *letters);20 JCFont(AImage *letters); 21 21 ~JCFont(); 22 22 23 void PutChar( image *screen, ivec2 pos, char ch, int color = -1);24 void PutString( image *screen, ivec2 pos, char const *st, int color = -1);23 void PutChar(AImage *screen, ivec2 pos, char ch, int color = -1); 24 void PutString(AImage *screen, ivec2 pos, char const *st, int color = -1); 25 25 ivec2 Size() const { return m_size; } 26 26 -
abuse/branches/lol/src/imlib/image.cpp
r708 r709 22 22 linked_list image_list; // FIXME: only jwindow.cpp needs this 23 23 24 image_descriptor::image_descriptor(ivec2 size, 25 int keep_dirties, int static_memory) 24 image_descriptor::image_descriptor(ivec2 size, int keep_dirties) 26 25 { 27 26 m_aa = ivec2(0); … … 30 29 31 30 keep_dirt = keep_dirties; 32 static_mem = static_memory; 33 } 34 35 void image::SetSize(ivec2 new_size, uint8_t *page) 36 { 37 DeletePage(); 38 m_size = new_size; 39 MakePage(new_size, page); 40 } 41 42 void image::MakePage(ivec2 size, uint8_t *page_buffer) 43 { 44 m_data = page_buffer ? page_buffer : (uint8_t *)malloc(size.x * size.y); 45 } 46 47 void image::DeletePage() 48 { 49 if (!m_special || !m_special->static_mem) 50 free(m_data); 51 } 52 53 image::~image() 54 { 55 if(m_locked) 56 { 57 fprintf(stderr, "Error: image is locked upon deletion\n"); 58 Unlock(); 59 } 60 31 } 32 33 void AImage::SetSize(ivec2 size) 34 { 35 m_size = size; 36 m_data.Resize(m_size.x * m_size.y); 37 } 38 39 AImage::~AImage() 40 { 61 41 image_list.unlink(this); 62 DeletePage();63 42 delete m_special; 64 43 } 65 44 66 uint8_t image::Pixel(ivec2 pos)45 uint8_t AImage::Pixel(ivec2 pos) 67 46 { 68 47 ASSERT(pos.x >= 0 && pos.x < m_size.x && pos.y >= 0 && pos.y < m_size.y, 69 " image::Pixel Bad pixel xy");48 "AImage::Pixel Bad pixel xy"); 70 49 return scan_line(pos.y)[pos.x]; 71 50 } 72 51 73 void image::PutPixel(ivec2 pos, uint8_t color)52 void AImage::PutPixel(ivec2 pos, uint8_t color) 74 53 { 75 54 ASSERT(pos.x >= 0 && pos.x < m_size.x && pos.y >= 0 && pos.y < m_size.y, 76 " image::PutPixel Bad pixel xy");55 "AImage::PutPixel Bad pixel xy"); 77 56 78 57 if (m_special && … … 84 63 } 85 64 86 87 image::image(ivec2 size, uint8_t *page_buffer, int create_descriptor) 65 AImage::AImage(ivec2 size, int create_descriptor) 88 66 { 89 67 m_size = size; 90 68 m_special = NULL; 91 if (create_descriptor || page_buffer) 92 m_special = new image_descriptor(size, create_descriptor == 2, 93 (page_buffer != NULL)); 94 MakePage(size, page_buffer); 69 m_data.Resize(m_size.x * m_size.y); 70 if (create_descriptor) 71 m_special = new image_descriptor(size, create_descriptor == 2); 95 72 image_list.add_end(this); 96 m_locked = false; 97 } 98 99 image::image(bFILE *fp, SpecEntry *e /* = NULL */) 73 } 74 75 AImage::AImage(bFILE *fp, SpecEntry *e /* = NULL */) 100 76 { 101 77 if (e) … … 104 80 m_size.y = fp->read_uint16(); 105 81 m_special = NULL; 106 MakePage(m_size, NULL);82 m_data.Resize(m_size.x * m_size.y); 107 83 for (int i = 0; i < m_size.y; i++) 108 84 fp->read(scan_line(i), m_size.x); 109 85 image_list.add_end(this); 110 m_locked = false;111 }112 113 void image::Lock()114 {115 /* This is currently a no-op, because it's unneeded with SDL */116 117 if(m_locked)118 fprintf(stderr, "Trying to lock a locked picture!\n");119 m_locked = true;120 }121 122 void image::Unlock()123 {124 /* This is currently a no-op, because it's unneeded with SDL */125 126 if(!m_locked)127 fprintf(stderr, "Trying to unlock an unlocked picture!\n");128 m_locked = false;129 86 } 130 87 … … 133 90 while (image_list.first()) 134 91 { 135 image *im = (image *)image_list.first();92 AImage *im = (AImage *)image_list.first(); 136 93 image_list.unlink(im); 137 94 delete im; … … 145 102 } 146 103 147 void image::clear(int color) 148 { 149 Lock(); 104 void AImage::clear(int color) 105 { 150 106 if(color == -1) 151 107 color = 0; // transparent … … 161 117 memset(scan_line(j), color, m_size.x); 162 118 AddDirty(ivec2(0), m_size); 163 Unlock(); 164 } 165 166 image *image::copy() 167 { 168 Lock(); 169 image *im = new image(m_size); 170 im->Lock(); 119 } 120 121 AImage *AImage::copy() 122 { 123 AImage *im = new AImage(m_size); 171 124 for(int j = 0; j < m_size.y; j++) 172 125 memcpy(im->scan_line(j), scan_line(j), m_size.x); 173 im->Unlock();174 Unlock();175 126 return im; 176 127 } … … 179 130 // Draw a line of the given colour on the image. Both endpoints are set. 180 131 // 181 void image::Line(ivec2 p1, ivec2 p2, uint8_t color)132 void AImage::Line(ivec2 p1, ivec2 p2, uint8_t color) 182 133 { 183 134 // check to see if the line is completly clipped off … … 232 183 int ery = 2 * lol::min(span.x * xi, span.y * yi); 233 184 234 Lock();235 185 for (int i = 0, er = 0; i <= lol::max(n, m); i++) 236 186 { … … 244 194 start += dy; 245 195 } 246 Unlock(); 247 } 248 249 250 void image::PutImage(image *im, ivec2 pos, int transparent) 196 } 197 198 199 void AImage::PutImage(AImage *im, ivec2 pos, int transparent) 251 200 { 252 201 PutPart(im, pos, ivec2(0), im->m_size, transparent); 253 202 } 254 203 255 void image::PutPart(image *im, ivec2 pos, ivec2 aa, ivec2 bb, int transparent)204 void AImage::PutPart(AImage *im, ivec2 pos, ivec2 aa, ivec2 bb, int transparent) 256 205 { 257 206 ASSERT(aa < bb); … … 283 232 AddDirty(pos, pos + span); 284 233 285 Lock();286 im->Lock();287 288 234 for (int j = 0; j < span.y; j++) 289 235 { … … 299 245 memcpy(dst, src, span.x); 300 246 } 301 302 im->Unlock(); 303 Unlock(); 304 } 305 306 void image::Rectangle(ivec2 p1, ivec2 p2, uint8_t color) 247 } 248 249 void AImage::Rectangle(ivec2 p1, ivec2 p2, uint8_t color) 307 250 { 308 251 Line(p1, ivec2(p2.x, p1.y), color); … … 312 255 } 313 256 314 void image::SetClip(ivec2 aa, ivec2 bb)315 { 316 // If the image does not already have an Image descriptor, allocate one257 void AImage::SetClip(ivec2 aa, ivec2 bb) 258 { 259 // If the image does not already have an AImage descriptor, allocate one 317 260 // with no dirty rectangle keeping. 318 261 if (!m_special) … … 324 267 } 325 268 326 void image::GetClip(ivec2 &aa, ivec2 &bb)269 void AImage::GetClip(ivec2 &aa, ivec2 &bb) 327 270 { 328 271 if (m_special) … … 335 278 } 336 279 337 void image::InClip(ivec2 aa, ivec2 bb)280 void AImage::InClip(ivec2 aa, ivec2 bb) 338 281 { 339 282 if (m_special) … … 346 289 } 347 290 348 void image::SetClip(int x1, int y1, int x2, int y2)349 { 350 // If the image does not already have an Image descriptor, allocate one291 void AImage::SetClip(int x1, int y1, int x2, int y2) 292 { 293 // If the image does not already have an AImage descriptor, allocate one 351 294 // with no dirty rectangle keeping. 352 295 if (!m_special) … … 358 301 } 359 302 360 void image::GetClip(int &x1, int &y1, int &x2, int &y2)303 void AImage::GetClip(int &x1, int &y1, int &x2, int &y2) 361 304 { 362 305 if (m_special) … … 368 311 } 369 312 370 void image::InClip(int x1, int y1, int x2, int y2)313 void AImage::InClip(int x1, int y1, int x2, int y2) 371 314 { 372 315 if (m_special) … … 579 522 } 580 523 581 void image::Bar(ivec2 p1, ivec2 p2, uint8_t color)524 void AImage::Bar(ivec2 p1, ivec2 p2, uint8_t color) 582 525 { 583 526 if (p1.x > p2.x || p1.y > p2.y) … … 601 544 return; 602 545 603 Lock();604 546 for (int y = p1.y; y <= p2.y; y++) 605 547 memset(scan_line(y) + p1.x, color, (p2.x - p1.x + 1)); 606 Unlock();607 548 AddDirty(p1, p2 + ivec2(1)); 608 549 } 609 550 610 void image::xor_bar(int x1, int y1, int x2, int y2, uint8_t color)551 void AImage::xor_bar(int x1, int y1, int x2, int y2, uint8_t color) 611 552 { 612 553 int y, x; … … 627 568 return ; 628 569 629 Lock();630 570 uint8_t *sl=scan_line(y1)+x1; 631 571 for (y=y1; y<=y2; y++) … … 636 576 sl+=m_size.x; 637 577 } 638 Unlock();639 578 640 579 AddDirty(ivec2(x1, y1), ivec2(x2 + 1, y2 + 1)); … … 642 581 643 582 644 void image::unpack_scanline(int line, char bitsperpixel)583 void AImage::unpack_scanline(int line, char bitsperpixel) 645 584 { 646 585 uint8_t *sl, *ex, mask, bt, sh; 647 586 ex=(uint8_t *)malloc(m_size.x); 648 587 649 Lock();650 588 sl=scan_line(line); 651 589 memcpy(ex, sl, m_size.x); 652 Unlock();653 590 654 591 if (bitsperpixel==1) { mask=128; bt=8; } … … 665 602 } 666 603 667 void image::dither(Palette *pal)604 void AImage::dither(Palette *pal) 668 605 { 669 606 uint8_t const dt_matrix[] = … … 675 612 }; 676 613 677 Lock();678 614 for (int y = 0; y < m_size.y; y++) 679 615 { … … 682 618 sl[x] = (pal->GetColor(sl[x]).r > dt_matrix[j * 4 + (x & 3)]) ? 255 : 0; 683 619 } 684 Unlock();685 620 } 686 621 … … 696 631 } 697 632 698 void image::Scale(ivec2 new_size)633 void AImage::Scale(ivec2 new_size) 699 634 { 700 635 ivec2 old_size = m_size; 701 636 uint8_t *im = (uint8_t *)malloc(old_size.x * old_size.y); 702 Lock();703 637 memcpy(im, scan_line(0), old_size.x * old_size.y); 704 638 705 DeletePage();706 MakePage(new_size, NULL);707 639 m_size = new_size; // set the new height and width 640 m_data.Resize(m_size.x * m_size.y); 708 641 709 642 uint8_t *sl1, *sl2; … … 724 657 if (m_special) 725 658 m_special->Resize(new_size); 726 Unlock(); 727 } 728 729 image *image::create_smooth(int smoothness) 730 { 731 ASSERT(smoothness >= 0); 732 733 int i, j, k, l, t, d; 734 image *im; 735 if (!smoothness) 736 return NULL; 737 d=smoothness*2+1; 738 d=d*d; 739 im=new image(m_size); 740 for (i=0; i<m_size.x; i++) 741 for (j=0; j<m_size.y; j++) 742 { 743 for (t=0, k=-smoothness; k<=smoothness; k++) 744 for (l=-smoothness; l<=smoothness; l++) 745 if (i+k>smoothness && i+k<m_size.x-smoothness && j+l<m_size.y-smoothness && j+l>smoothness) 746 t+=Pixel(ivec2(i+k, j+l)); 747 else t+=Pixel(ivec2(i, j)); 748 im->PutPixel(ivec2(i, j), t/d); 749 } 750 return im; 751 } 752 753 void image::WidgetBar(ivec2 p1, ivec2 p2, 659 } 660 661 AImage *AImage::create_smooth(int smoothness) 662 { 663 ASSERT(smoothness >= 0); 664 665 if (!smoothness) 666 return NULL; 667 int d = smoothness * 2 + 1; 668 d = d * d; 669 AImage *im = new AImage(m_size); 670 671 /* Box blur */ 672 for (int i = 0; i < m_size.x; i++) 673 for (int j = 0; j < m_size.y; j++) 674 { 675 int t = 0; 676 for (int k = -smoothness; k <= smoothness; k++) 677 for (int l = -smoothness; l <= smoothness; l++) 678 if (i + k > smoothness && i + k < m_size.x - smoothness 679 && j + l < m_size.y - smoothness && j + l > smoothness) 680 t += Pixel(ivec2(i + k, j + l)); 681 else 682 t += Pixel(ivec2(i, j)); 683 im->PutPixel(ivec2(i, j), t / d); 684 } 685 686 return im; 687 } 688 689 void AImage::WidgetBar(ivec2 p1, ivec2 p2, 754 690 uint8_t light, uint8_t med, uint8_t dark) 755 691 { … … 770 706 } ; 771 707 772 void image::flood_fill(int x, int y, uint8_t color)708 void AImage::flood_fill(int x, int y, uint8_t color) 773 709 { 774 710 uint8_t *sl, *above, *below; 775 711 fill_rec *recs=NULL, *r; 776 712 uint8_t fcolor; 777 Lock(); 713 778 714 sl=scan_line(y); 779 715 fcolor=sl[x]; … … 849 785 } 850 786 } while (recs); 851 Unlock();852 787 } 853 788 … … 855 790 #define LED_L 5 856 791 #define LED_H 5 857 void image::burn_led(int x, int y, int32_t num, int color, int scale)792 void AImage::burn_led(int x, int y, int32_t num, int color, int scale) 858 793 { 859 794 char st[100]; … … 887 822 119, 255, 85, 221}; 888 823 889 image *image::copy_part_dithered (int x1, int y1, int x2, int y2)824 AImage *AImage::copy_part_dithered (int x1, int y1, int x2, int y2) 890 825 { 891 826 int x, y, ry, rx, bo, dity, ditx; 892 image *ret;827 AImage *ret; 893 828 uint8_t *sl1, *sl2; 894 829 ivec2 caa, cbb; … … 903 838 904 839 if (x2<x1 || y2<y1) return NULL; 905 ret=new image(ivec2((x2-x1+8)/8, (y2-y1+1)));840 ret=new AImage(ivec2((x2-x1+8)/8, (y2-y1+1))); 906 841 if (!Palette::LastLoaded()) 907 842 ret->clear(); 908 843 else 909 844 { 910 ret->Lock();911 Lock();912 845 for (y=y1, ry=0, dity=(y1%4)*4; y<=y2; y++, ry++) 913 846 { … … 930 863 dity+=4; if (dity>12) dity=0; 931 864 } 932 Unlock();933 ret->Unlock();934 865 } 935 866 return ret; 936 867 } 937 868 938 void image::FlipX() 939 { 940 Lock(); 869 void AImage::FlipX() 870 { 941 871 for (int y = 0; y < m_size.y; y++) 942 872 { … … 949 879 } 950 880 } 951 Unlock(); 952 } 953 954 void image::FlipY() 955 { 956 Lock(); 881 } 882 883 void AImage::FlipY() 884 { 957 885 for (int y = 0; y < m_size.y / 2; y++) 958 886 { … … 966 894 } 967 895 } 968 Unlock(); 969 } 970 896 } 897 -
abuse/branches/lol/src/imlib/image.h
r698 r709 43 43 { 44 44 public: 45 uint8_t keep_dirt, 46 static_mem; // if set, don't free memory on exit 45 uint8_t keep_dirt; 47 46 48 47 linked_list dirties; 49 48 void *extended_descriptor; 50 49 51 image_descriptor(ivec2 size, int keep_dirties = 1 , int static_memory = 0);50 image_descriptor(ivec2 size, int keep_dirties = 1); 52 51 int bound_x1(int x1) { return lol::max(x1, m_aa.x); } 53 52 int bound_y1(int y1) { return lol::max(y1, m_aa.y); } … … 93 92 }; 94 93 95 class image : public linked_node94 class AImage : public linked_node 96 95 { 96 public: 97 AImage(bFILE *fp, SpecEntry *e = NULL); 98 AImage(ivec2 size, int create_descriptor = 0); 99 ~AImage(); 100 101 uint8_t Pixel(ivec2 pos); 102 void PutPixel(ivec2 pos, uint8_t color); 103 104 ivec2 Size() const { return m_size; } 105 97 106 private: 98 uint8_t *m_data;107 Array<uint8_t> m_data; 99 108 ivec2 m_size; 100 bool m_locked;101 102 void MakePage(ivec2 size, uint8_t *page_buffer);103 void DeletePage();104 109 105 110 public: 106 111 image_descriptor *m_special; 107 112 108 image(bFILE *fp, SpecEntry *e = NULL);109 image(ivec2 size, uint8_t *page_buffer = NULL, int create_descriptor = 0);110 ~image();111 112 void Lock();113 void Unlock();114 115 uint8_t Pixel(ivec2 pos);116 void PutPixel(ivec2 pos, uint8_t color);117 118 113 inline uint8_t *scan_line(int y) 119 114 { 120 return m_data + y * m_size.x; 115 /* FIXME: use the following construct for runtime checks */ 116 //return &m_data[y * m_size.x]; 117 118 return m_data.Data() + y * m_size.x; 121 119 } 122 image *copy(); // makes a copy of an image120 AImage *copy(); // makes a copy of an image 123 121 void clear(int color = -1); // -1 is background color 124 122 125 ivec2 Size() const { return m_size; } 126 127 void PutImage(image *screen, ivec2 pos, int transparent = 0); 128 void PutPart(image *screen, ivec2 pos, ivec2 aa, ivec2 bb, 123 void PutImage(AImage *screen, ivec2 pos, int transparent = 0); 124 void PutPart(AImage *screen, ivec2 pos, ivec2 aa, ivec2 bb, 129 125 int transparent = 0); 130 image *copy_part_dithered(int x1, int y1, int x2, int y2);126 AImage *copy_part_dithered(int x1, int y1, int x2, int y2); 131 127 void Bar(ivec2 p1, ivec2 p2, uint8_t color); 132 128 void xor_bar(int x1, int y1, int x2, int y2, uint8_t color); … … 166 162 void dither(Palette *pal); // use a b&w palette! 167 163 void Scale(ivec2 size); 168 void SetSize(ivec2 size , uint8_t *page = NULL);164 void SetSize(ivec2 size); 169 165 void flood_fill(int x, int y, uint8_t color); 170 image *create_smooth(int smoothness = 1); // 0 no smoothness166 AImage *create_smooth(int smoothness = 1); // 0 no smoothness 171 167 void unpack_scanline(int line, char bitsperpixel = 1); 172 168 void FlipX(); -
abuse/branches/lol/src/imlib/include.cpp
r694 r709 18 18 #include "ctype.h" 19 19 20 void write_include( image *im, Palette *pal, char *filename, char *name)20 void write_include(AImage *im, Palette *pal, char *filename, char *name) 21 21 { 22 22 char tmp_name[200]; -
abuse/branches/lol/src/imlib/include.h
r694 r709 14 14 #include "palette.h" 15 15 16 void write_include( image *im, Palette *pal, char *filename, char *name);16 void write_include(AImage *im, Palette *pal, char *filename, char *name); 17 17 18 18 #endif -
abuse/branches/lol/src/imlib/input.cpp
r707 r709 84 84 } 85 85 86 void button_box::draw_first( image *screen)86 void button_box::draw_first(AImage *screen) 87 87 { 88 88 for (button *b=buttons; b; b=(button *)b->next) … … 90 90 } 91 91 92 void button_box::draw(int active, image *screen)92 void button_box::draw(int active, AImage *screen) 93 93 { 94 94 return ; … … 112 112 } 113 113 114 void button_box::handle_event(Event &ev, image *screen, InputManager *im)114 void button_box::handle_event(Event &ev, AImage *screen, InputManager *im) 115 115 { 116 116 switch (ev.type) … … 190 190 } 191 191 192 void button::change_visual( image *new_visual)192 void button::change_visual(AImage *new_visual) 193 193 { 194 194 ASSERT(visual); … … 225 225 226 226 227 button::button(int X, int Y, int ID, image *vis, ifield *Next)227 button::button(int X, int Y, int ID, AImage *vis, ifield *Next) 228 228 { 229 229 m_pos = ivec2(X, Y); … … 234 234 } 235 235 236 button::button(int X, int Y, int ID, image *Depressed, image *Pressed, image *active, ifield *Next)236 button::button(int X, int Y, int ID, AImage *Depressed, AImage *Pressed, AImage *active, ifield *Next) 237 237 { 238 238 m_pos = ivec2(X, Y); … … 246 246 247 247 void text_field::change_data(char const *new_data, int new_cursor, // cursor==-1, does not change it. 248 int active, image *screen)248 int active, AImage *screen) 249 249 { 250 250 if (strlen(format)<strlen(new_data)) … … 264 264 } 265 265 266 void text_field::handle_event(Event &ev, image *screen, InputManager *im)266 void text_field::handle_event(Event &ev, AImage *screen, InputManager *im) 267 267 { 268 268 int xx; … … 308 308 } 309 309 310 void text_field::draw(int active, image *screen)310 void text_field::draw(int active, AImage *screen) 311 311 { 312 312 if (active) … … 364 364 { up=!up; } 365 365 366 void button::handle_event(Event &ev, image *screen, InputManager *im)366 void button::handle_event(Event &ev, AImage *screen, InputManager *im) 367 367 { 368 368 if ((ev.type==EV_KEY && ev.key==13) || (ev.type==EV_MOUSE_BUTTON && … … 378 378 } 379 379 380 void button::draw(int active, image *screen)380 void button::draw(int active, AImage *screen) 381 381 { 382 382 int x1,y1,x2,y2,color=(active ? wm->bright_color() : wm->medium_color()); … … 402 402 } 403 403 404 void button::draw_first( image *screen)404 void button::draw_first(AImage *screen) 405 405 { 406 406 if (pressed) … … 441 441 } 442 442 443 void text_field::draw_first( image *screen)443 void text_field::draw_first(AImage *screen) 444 444 { 445 445 wm->font()->PutString(screen, m_pos + ivec2(0, 3), prompt); … … 449 449 450 450 451 void text_field::draw_cur(int color, image *screen)451 void text_field::draw_cur(int color, AImage *screen) 452 452 { 453 453 screen->Bar(ivec2(xstart() + cur * wm->font()->Size().x + 1, yend() - 2), … … 490 490 } 491 491 492 void info_field::put_para( image *screen, char const *st, int dx, int dy,492 void info_field::put_para(AImage *screen, char const *st, int dx, int dy, 493 493 int xspace, int yspace, JCFont *font, int color) 494 494 { … … 510 510 } 511 511 512 void info_field::draw_first( image *screen)512 void info_field::draw_first(AImage *screen) 513 513 { 514 514 put_para(screen, text, m_pos.x+1, m_pos.y+1, wm->font()->Size().x, -
abuse/branches/lol/src/imlib/input.h
r682 r709 20 20 int up,act; 21 21 char *text; 22 image *visual,*pressed,*act_pict;22 AImage *visual,*pressed,*act_pict; 23 23 int act_id; 24 24 public : 25 25 button(int X, int Y, int ID, char const *Text, ifield *Next); 26 button(int X, int Y, int ID, image *vis, ifield *Next);27 button(int X, int Y, int ID, image *Depressed, image *Pressed, image *active, ifield *Next);26 button(int X, int Y, int ID, AImage *vis, ifield *Next); 27 button(int X, int Y, int ID, AImage *Depressed, AImage *Pressed, AImage *active, ifield *Next); 28 28 29 29 virtual void area(int &x1, int &y1, int &x2, int &y2); 30 virtual void draw_first( image *screen);31 virtual void draw(int active, image *screen);32 virtual void handle_event(Event &ev, image *screen, InputManager *im);33 void change_visual( image *new_visual);30 virtual void draw_first(AImage *screen); 31 virtual void draw(int active, AImage *screen); 32 virtual void handle_event(Event &ev, AImage *screen, InputManager *im); 33 void change_visual(AImage *new_visual); 34 34 virtual void remap(Filter *f); 35 35 virtual ~button() { if (text) free(text); } … … 51 51 virtual void Move(ivec2 pos); 52 52 virtual void area(int &x1, int &y1, int &x2, int &y2); 53 virtual void draw_first( image *screen);54 virtual void draw(int active, image *screen);55 virtual void handle_event(Event &ev, image *screen, InputManager *im);53 virtual void draw_first(AImage *screen); 54 virtual void draw(int active, AImage *screen); 55 virtual void handle_event(Event &ev, AImage *screen, InputManager *im); 56 56 virtual ~button_box(); 57 57 virtual char *read(); // return pointer to first button which is depressed … … 68 68 int xend() { return m_pos.x + wm->font()->Size().x * (strlen(prompt) + 1 + strlen(format)) + 7; } 69 69 int yend() { return m_pos.y + wm->font()->Size().y + 5; } 70 void draw_cur(int color, image *screen);70 void draw_cur(int color, AImage *screen); 71 71 int last_spot() { int x=strlen(data); while (x && data[x-1]==' ') x--; return x; } 72 void draw_text( image *screen)72 void draw_text(AImage *screen) 73 73 { 74 74 screen->Bar(ivec2(xstart() + 1, m_pos.y + 1), ivec2(xend() - 1, yend() - 1), … … 83 83 84 84 virtual void area(int &x1, int &y1, int &x2, int &y2); 85 virtual void draw_first( image *screen);86 virtual void draw(int active, image *screen);87 virtual void handle_event(Event &ev, image *screen, InputManager *im);85 virtual void draw_first(AImage *screen); 86 virtual void draw(int active, AImage *screen); 87 virtual void handle_event(Event &ev, AImage *screen, InputManager *im); 88 88 89 89 virtual ~text_field() { free(prompt); free(format); free(data); } 90 90 virtual char *read(); 91 91 void change_data(char const *new_data, int new_cursor, // cursor==-1, does not change it. 92 int active, image *screen);92 int active, AImage *screen); 93 93 } ; 94 94 … … 98 98 char *text; 99 99 int w,h; 100 void put_para( image *screen, char const *st, int dx, int dy, int xspace,100 void put_para(AImage *screen, char const *st, int dx, int dy, int xspace, 101 101 int yspace, JCFont *font, int color); 102 102 public : 103 103 info_field(int X, int Y, int ID, char const *info, ifield *Next); 104 104 virtual void area(int &x1, int &y1, int &x2, int &y2); 105 virtual void draw_first( image *screen);106 virtual void draw(int active, image *screen) { (void)active; (void)screen; }107 virtual void handle_event(Event &ev, image *screen, InputManager *im)105 virtual void draw_first(AImage *screen); 106 virtual void draw(int active, AImage *screen) { (void)active; (void)screen; } 107 virtual void handle_event(Event &ev, AImage *screen, InputManager *im) 108 108 { 109 109 (void)ev; (void)screen; (void)im; -
abuse/branches/lol/src/imlib/jwindow.cpp
r694 r709 45 45 46 46 void WindowManager::grab_focus(Jwindow *j) 47 { m_grab=j; } 47 { 48 m_grab = j; 49 } 48 50 49 51 void WindowManager::release_focus() 50 { m_grab=NULL; } 51 52 { 53 m_grab = nullptr; 54 } 52 55 53 56 void WindowManager::close_window(Jwindow *j) … … 70 73 void WindowManager::show_windows() 71 74 { 72 Jwindow *p; 73 for (p=m_first; p; p=p->next) 74 if (p->is_hidden()) 75 show_window(p); 75 for (Jwindow *p = m_first; p; p = p->next) 76 if (p->is_hidden()) 77 show_window(p); 76 78 } 77 79 … … 105 107 void WindowManager::get_event(Event &ev) 106 108 { 107 Get(ev); 108 109 if (ev.type==EV_KEY) 110 key_state[ev.key]=1; 111 else if (ev.type==EV_KEYRELEASE) 112 key_state[ev.key]=0; 113 114 if (state==inputing) 115 { 116 Jwindow *j; 117 for (ev.window=NULL,j=m_first; j; j=j->next) 118 if (!j->is_hidden() && ev.mouse_move >= j->m_pos 119 && ev.mouse_move < j->m_pos + j->m_size) 120 ev.window=j; 121 122 if (!ev.window && m_grab) ev.window=m_grab; 123 124 if (ev.window) 125 { 126 int closew=0,movew=0; 127 128 if ((ev.type==EV_MOUSE_BUTTON && ev.mouse_button==1 && ev.window && 129 ev.mouse_move >= ev.window->m_pos && 130 ev.mouse_move < ev.window->m_pos + ivec2(ev.window->m_size.x, ev.window->y1()))) 131 { 132 if (ev.mouse_move.x-ev.window->m_pos.x < 11) closew=1; 133 else if (ev.window->is_moveable()) movew=1; 134 } else if (m_grab) 135 ev.window=m_grab; 136 137 if (ev.type==EV_KEY && ev.key==JK_ESC) 138 closew=1; 139 140 141 142 if (closew) 143 ev.type=EV_CLOSE_WINDOW; 144 else if (movew) 145 { 146 int red=0; 147 if (ev.window==m_first) // see if we need to raise the window 148 { 149 m_first=m_first->next; 150 if (m_first) 151 red=1; 152 } 153 else 154 { 155 Jwindow *last=m_first; 156 for (; last->next!=ev.window; last=last->next); 157 if (ev.window->next) 158 red=1; 159 last->next=ev.window->next; 160 } 161 if (!m_first) 162 m_first=ev.window; 163 else 164 { 165 Jwindow *last=m_first; 166 for (; last->next; last=last->next); 167 last->next=ev.window; 168 } 169 ev.window->next=NULL; 170 if (red) 171 { 172 Jwindow *j=ev.window; 109 Get(ev); 110 111 if (ev.type == EV_KEY) 112 key_state[ev.key] = 1; 113 else if (ev.type == EV_KEYRELEASE) 114 key_state[ev.key] = 0; 115 116 if (state == inputing) 117 { 118 Jwindow *j; 119 for (ev.window = NULL, j = m_first; j; j = j->next) 120 if (!j->is_hidden() && ev.mouse_move >= j->m_pos 121 && ev.mouse_move < j->m_pos + j->m_size) 122 ev.window = j; 123 124 if (!ev.window && m_grab) 125 ev.window = m_grab; 126 127 if (ev.window) 128 { 129 int closew = 0, movew = 0; 130 131 if ((ev.type == EV_MOUSE_BUTTON && ev.mouse_button == 1 && ev.window && 132 ev.mouse_move >= ev.window->m_pos && 133 ev.mouse_move < ev.window->m_pos + ivec2(ev.window->m_size.x, ev.window->y1()))) 134 { 135 if (ev.mouse_move.x - ev.window->m_pos.x < 11) 136 closew = 1; 137 else if (ev.window->is_moveable()) 138 movew = 1; 139 } 140 else if (m_grab) 141 ev.window = m_grab; 142 143 if (ev.type == EV_KEY && ev.key == JK_ESC) 144 closew = 1; 145 146 if (closew) 147 ev.type = EV_CLOSE_WINDOW; 148 else if (movew) 149 { 150 int red = 0; 151 if (ev.window == m_first) // see if we need to raise the window 152 { 153 m_first = m_first->next; 154 if (m_first) 155 red = 1; 156 } 157 else 158 { 159 Jwindow *last = m_first; 160 for (; last->next != ev.window; last = last->next) 161 ; 162 if (ev.window->next) 163 red = 1; 164 last->next = ev.window->next; 165 } 166 if (!m_first) 167 m_first = ev.window; 168 else 169 { 170 Jwindow *last = m_first; 171 for (; last->next; last=last->next) 172 ; 173 last->next = ev.window; 174 } 175 ev.window->next = nullptr; 176 if (red) 177 { 178 Jwindow *j = ev.window; 173 179 /* m_surf->AddDirty(j->x,j->y,j->x+j->l,j->y+j->h); 174 180 for (p=m_first; p!=j; p=p->next) 175 181 p->m_surf->AddDirty(j->x-p->x,j->y-p->y,j->x+j->l-p->x,j->y+j->h-p->y); */ 176 j->m_surf->AddDirty(ivec2(0), j->m_size); 177 flush_screen(); 178 } 179 180 state=dragging; 181 drag_window=ev.window; 182 drag_mousex=ev.window->m_pos.x-ev.mouse_move.x; 183 drag_mousey=ev.window->m_pos.y-ev.mouse_move.y; 184 ev.type=EV_SPURIOUS; 185 } else if (ev.window) 186 ev.window->inm->handle_event(ev,ev.window); 187 } 188 } else if (state==dragging) 189 { 190 ev.window=drag_window; 191 if (ev.type==EV_MOUSE_BUTTON && ev.mouse_button==0) // user released the mouse 192 { 193 state=inputing; 194 ev.type=EV_SPURIOUS; 195 } else if (ev.type==EV_MOUSE_MOVE) 196 { 197 move_window(drag_window,ev.mouse_move.x+drag_mousex,ev.mouse_move.y+drag_mousey); 198 flush_screen(); 199 ev.type=EV_DRAG_WINDOW; 200 ev.window_position.x=ev.mouse_move.x+drag_mousex; 201 ev.window_position.y=ev.mouse_move.y+drag_mousey; 202 } 203 } 182 j->m_surf->AddDirty(ivec2(0), j->m_size); 183 flush_screen(); 184 } 185 186 state = dragging; 187 drag_window = ev.window; 188 drag_mousex = ev.window->m_pos.x - ev.mouse_move.x; 189 drag_mousey = ev.window->m_pos.y - ev.mouse_move.y; 190 ev.type = EV_SPURIOUS; 191 } 192 else if (ev.window) 193 ev.window->inm->handle_event(ev, ev.window); 194 } 195 } 196 else if (state == dragging) 197 { 198 ev.window = drag_window; 199 if (ev.type == EV_MOUSE_BUTTON && ev.mouse_button == 0) // user released the mouse 200 { 201 state = inputing; 202 ev.type = EV_SPURIOUS; 203 } 204 else if (ev.type == EV_MOUSE_MOVE) 205 { 206 move_window(drag_window, 207 ev.mouse_move.x + drag_mousex, 208 ev.mouse_move.y + drag_mousey); 209 flush_screen(); 210 ev.type = EV_DRAG_WINDOW; 211 ev.window_position.x = ev.mouse_move.x + drag_mousex; 212 ev.window_position.y = ev.mouse_move.y + drag_mousey; 213 } 214 } 204 215 } 205 216 … … 212 223 void WindowManager::resize_window(Jwindow *j, int l, int h) 213 224 { 214 Jwindow *p; 215 m_surf->AddDirty(j->m_pos, j->m_pos + j->m_size); 216 for (p=m_first; p!=j; p=p->next) 217 p->m_surf->AddDirty(j->m_pos - p->m_pos, 218 j->m_pos - p->m_pos + j->m_size); 219 j->Resize(ivec2(l,h)); 220 if (!frame_suppress) 221 j->redraw(); 225 m_surf->AddDirty(j->m_pos, j->m_pos + j->m_size); 226 for (Jwindow *p = m_first; p != j; p = p->next) 227 p->m_surf->AddDirty(j->m_pos - p->m_pos, 228 j->m_pos - p->m_pos + j->m_size); 229 j->Resize(ivec2(l, h)); 230 if (!frame_suppress) 231 j->redraw(); 222 232 } 223 233 … … 233 243 } 234 244 235 WindowManager::WindowManager( image *screen, Palette *pal, int Hi,245 WindowManager::WindowManager(AImage *screen, Palette *pal, int Hi, 236 246 int Med, int Low, JCFont *Font) 237 247 : EventHandler(screen, pal) … … 255 265 void WindowManager::add_window(Jwindow *win) 256 266 { 257 if (!m_first)267 if (!m_first) 258 268 m_first = win; 259 269 else 260 270 { 261 271 Jwindow *tmp = m_first; 262 while (tmp->next)272 while (tmp->next) 263 273 tmp = tmp->next; 264 274 tmp->next = win; 265 win->next = NULL;275 win->next = nullptr; 266 276 } 267 277 } … … 270 280 { 271 281 if(m_grab == win) 272 m_grab = NULL;282 m_grab = nullptr; 273 283 274 284 // close the window we were dragging … … 360 370 // property.flags = JWINDOW_NOAUTOHIDE_FLAG; 361 371 362 inm = new InputManager(this, NULL);372 inm = new InputManager(this, nullptr); 363 373 reconfigure(); 364 374 365 m_surf = NULL;366 next = NULL;367 368 _name = NULL;375 m_surf = nullptr; 376 next = nullptr; 377 378 _name = nullptr; 369 379 if(name) 370 380 _name = strdup(name); … … 381 391 _y1 = name ? top_border() : jw_top + 5; 382 392 383 m_surf = NULL;393 m_surf = nullptr; 384 394 inm = new InputManager(m_surf, f); 385 395 reconfigure(); /* FIXME: TODO */ … … 400 410 if(size.y == -1) 401 411 m_size.y = lol::max(m_size.y, top_border() + bottom_border()); 402 m_surf = new image(m_size, NULL, 2);412 m_surf = new AImage(m_size, 2); 403 413 m_surf->clear(backg); 404 414 // Keep this from getting destroyed when image list is cleared … … 406 416 inm->m_surf = m_surf; 407 417 408 next = NULL;409 410 _name = NULL;418 next = nullptr; 419 420 _name = nullptr; 411 421 if(name) 412 422 _name = strdup(name); … … 522 532 } 523 533 524 525 ifield *InputManager::unlink(int id) // unlinks ID from fields list and return the pointer to it 526 { 527 for (ifield *i=m_first,*last=NULL; i; i=i->next) 528 { 529 if (i->id==id) 530 { 531 if (i==m_first) 532 m_first=m_first->next; 533 else 534 last->next=i->next; 535 if (m_active==i) 536 m_active=m_first; 537 return i; 538 } 539 ifield *x=i->unlink(id); 540 if (x) return x; 541 last=i; 542 } 543 return NULL; // no such id 534 // unlinks ID from fields list and return the pointer to it 535 ifield *InputManager::unlink(int id) 536 { 537 for (ifield *i = m_first, *last = nullptr; i; i = i->next) 538 { 539 if (i->id == id) 540 { 541 if (i == m_first) 542 m_first = m_first->next; 543 else 544 last->next = i->next; 545 546 if (m_active == i) 547 m_active = m_first; 548 549 return i; 550 } 551 ifield *x = i->unlink(id); 552 if (x) 553 return x; 554 last = i; 555 } 556 return nullptr; // no such id 544 557 } 545 558 … … 638 651 void InputManager::redraw() 639 652 { 640 ifield *i; 641 if(m_owner) 653 if (m_owner) 642 654 m_surf = m_owner->m_surf; 643 for (i = m_first; i; i = i->next)655 for (ifield *i = m_first; i; i = i->next) 644 656 i->draw_first(m_surf); 645 if (m_active)657 if (m_active) 646 658 m_active->draw(1, m_surf); 647 659 } 648 660 649 InputManager::InputManager( image *screen, ifield *first)661 InputManager::InputManager(AImage *screen, ifield *first) 650 662 { 651 663 no_selections_allowed = 0; … … 655 667 m_surf = screen; 656 668 m_active = m_first = first; 657 while (m_active && !m_active->selectable())669 while (m_active && !m_active->selectable()) 658 670 m_active = m_active->next; 659 if (m_surf)671 if (m_surf) 660 672 redraw(); 661 673 } … … 695 707 696 708 void InputManager::add(ifield *i) 697 { ifield *f=m_first; 698 if (i->selectable()) 699 { 700 if (!f) 701 m_first=i; 702 else 703 { 704 while (f->next) f=f->next; 705 f->next=i; 706 } 707 } 709 { 710 if (i->selectable()) 711 { 712 if (!m_first) 713 m_first = i; 714 else 715 { 716 ifield *f = m_first; 717 while (f->next) 718 f = f->next; 719 f->next = i; 720 } 721 } 708 722 } 709 723 710 724 ifield *InputManager::get(int id) 711 725 { 712 ifield *f;713 for (f=m_first; f; f=f->next)714 {715 ifield *ret=f->find(id);716 if (ret)return ret;717 }718 return NULL;726 for (ifield * f = m_first; f; f = f->next) 727 { 728 ifield *ret = f->find(id); 729 if (ret) 730 return ret; 731 } 732 return nullptr; 719 733 } 720 734 721 735 ifield::ifield() 722 736 { 723 owner = NULL;737 owner = nullptr; 724 738 m_pos = ivec2(0, 0); 725 next = NULL;739 next = nullptr; 726 740 id = 0; 727 741 } -
abuse/branches/lol/src/imlib/jwindow.h
r698 r709 34 34 35 35 public: 36 InputManager( image *screen, ifield *first);36 InputManager(AImage *screen, ifield *first); 37 37 InputManager(Jwindow *owner, ifield *first); 38 38 ~InputManager(); … … 50 50 51 51 private: 52 image *m_surf;52 AImage *m_surf; 53 53 ifield *m_first, *m_active, *m_grab; 54 54 Jwindow *m_cur, *m_owner; … … 68 68 virtual void Move(ivec2 pos) { m_pos = pos; } 69 69 virtual void area(int &x1, int &y1, int &x2, int &y2) = 0; 70 virtual void draw_first( image *screen) = 0;71 virtual void draw(int active, image *screen) = 0;72 virtual void handle_event(Event &ev, image *screen, InputManager *im) = 0;70 virtual void draw_first(AImage *screen) = 0; 71 virtual void draw(int active, AImage *screen) = 0; 72 virtual void handle_event(Event &ev, AImage *screen, InputManager *im) = 0; 73 73 virtual int selectable() { return 1; } 74 74 virtual void remap(Filter *f) { (void)f; } … … 122 122 123 123 ivec2 m_pos, m_size; 124 image *m_surf;124 AImage *m_surf; 125 125 126 126 protected: … … 145 145 146 146 public: 147 WindowManager( image *, Palette *, int hi, int med, int low, JCFont *);147 WindowManager(AImage *, Palette *, int hi, int med, int low, JCFont *); 148 148 ~WindowManager(); 149 149 150 150 Jwindow *m_first, *m_grab; 151 image *mouse_pic, *mouse_save;151 AImage *mouse_pic, *mouse_save; 152 152 int hi, med, low, bk; // bright, medium, dark and black colors 153 153 int key_state[512]; … … 183 183 private: 184 184 Palette *m_pal; 185 image *m_surf;185 AImage *m_surf; 186 186 }; 187 187 -
abuse/branches/lol/src/imlib/pcxread.cpp
r694 r709 120 120 } 121 121 122 image *read_PCX(char const *filename, Palette *&pal)122 AImage *read_PCX(char const *filename, Palette *&pal) 123 123 { 124 124 if (PCX_file_type(filename)!=PCX_8) return NULL; … … 126 126 read_PCX_header(fp); 127 127 128 image *im=new image(ivec2(PCX_header.xmax-PCX_header.xmin+1,128 AImage *im=new AImage(ivec2(PCX_header.xmax-PCX_header.xmin+1, 129 129 PCX_header.ymax-PCX_header.ymin+1)); 130 130 int y; … … 146 146 } 147 147 148 void write_PCX( image *im, Palette *pal, char const *filename)148 void write_PCX(AImage *im, Palette *pal, char const *filename) 149 149 { 150 150 FILE *fp=fopen(filename,"wb"); -
abuse/branches/lol/src/imlib/pcxread.h
r694 r709 15 15 #include "palette.h" 16 16 17 void write_PCX( image *im, Palette *pal, char const *filename);18 image *read_PCX(char const *filename, Palette *&pal);17 void write_PCX(AImage *im, Palette *pal, char const *filename); 18 AImage *read_PCX(char const *filename, Palette *&pal); 19 19 20 20 #endif -
abuse/branches/lol/src/imlib/pmenu.cpp
r707 r709 24 24 } 25 25 26 pmenu::pmenu(int X, int Y, pmenu_item *first, image *screen)26 pmenu::pmenu(int X, int Y, pmenu_item *first, AImage *screen) 27 27 { 28 28 top=first; … … 312 312 313 313 314 void pmenu::draw( image *screen, int top_only)314 void pmenu::draw(AImage *screen, int top_only) 315 315 { 316 316 … … 380 380 } 381 381 382 pmenu_item *pmenu::inarea(int mx, int my, image *screen)382 pmenu_item *pmenu::inarea(int mx, int my, AImage *screen) 383 383 { 384 384 mx-=bar->m_pos.x; … … 416 416 } 417 417 418 int pmenu::handle_event(Event &ev, image *screen)418 int pmenu::handle_event(Event &ev, AImage *screen) 419 419 { 420 420 if (!active && ev.window!=bar) return 0; -
abuse/branches/lol/src/imlib/pmenu.h
r668 r709 66 66 { return strlen(p->name())*wm->font()->Size().x+2; } 67 67 int itemx(pmenu_item *p); 68 pmenu_item *inarea(int mx, int my, image *screen);68 pmenu_item *inarea(int mx, int my, AImage *screen); 69 69 public : 70 70 ~pmenu(); 71 pmenu(int X, int Y, pmenu_item *first, image *screen);71 pmenu(int X, int Y, pmenu_item *first, AImage *screen); 72 72 void move(int new_x, int new_y); 73 void draw( image *screen, int top_only=0);74 int handle_event(Event &ev, image *screen);73 void draw(AImage *screen, int top_only=0); 74 int handle_event(Event &ev, AImage *screen); 75 75 76 76 } ; -
abuse/branches/lol/src/imlib/scroller.cpp
r707 r709 55 55 0, 0, 0, 0, 0}; 56 56 57 void show_icon( image *screen, int x, int y, int icw, int ich, uint8_t *buf)57 void show_icon(AImage *screen, int x, int y, int icw, int ich, uint8_t *buf) 58 58 { 59 59 ivec2 caa, cbb; … … 65 65 remap[2]=wm->dark_color(); 66 66 67 screen->Lock();68 67 for (int yc=ich; yc; yc--,y++) 69 68 { … … 79 78 } 80 79 screen->AddDirty(ivec2(x, y), ivec2(x + icw, y + ich)); 81 screen->Unlock();82 80 } 83 81 … … 120 118 121 119 122 void scroller::draw_first( image *screen)120 void scroller::draw_first(AImage *screen) 123 121 { 124 122 if (sx>=t) sx=t-1; … … 163 161 } 164 162 165 void scroller::draw_widget( image *screen, int erase)163 void scroller::draw_widget(AImage *screen, int erase) 166 164 { 167 165 int x1,y1,x2,y2; … … 174 172 } 175 173 176 void scroller::draw(int active, image *screen)174 void scroller::draw(int active, AImage *screen) 177 175 { 178 176 int x1,y1,x2,y2; … … 182 180 } 183 181 184 void scroller::handle_event(Event &ev, image *screen, InputManager *inm)182 void scroller::handle_event(Event &ev, AImage *screen, InputManager *inm) 185 183 { 186 184 int mx=ev.mouse_move.x,my=ev.mouse_move.y; … … 286 284 287 285 288 void scroller::handle_right( image *screen, InputManager *inm)286 void scroller::handle_right(AImage *screen, InputManager *inm) 289 287 { 290 288 if (!vert && sx<t-1) … … 297 295 } 298 296 299 void scroller::handle_left( image *screen, InputManager *inm)297 void scroller::handle_left(AImage *screen, InputManager *inm) 300 298 { 301 299 if (!vert && sx>1) … … 308 306 } 309 307 310 void scroller::handle_up( image *screen, InputManager *inm)308 void scroller::handle_up(AImage *screen, InputManager *inm) 311 309 { 312 310 if (vert && sx>1) … … 319 317 } 320 318 321 void scroller::handle_down( image *screen, InputManager *inm)319 void scroller::handle_down(AImage *screen, InputManager *inm) 322 320 { 323 321 if (vert && sx<t-1) … … 330 328 } 331 329 332 void scroller::set_x (int x, image *screen)330 void scroller::set_x (int x, AImage *screen) 333 331 { 334 332 if (x<0) x=0; … … 365 363 366 364 367 void scroller::scroll_event(int newx, image *screen)365 void scroller::scroll_event(int newx, AImage *screen) 368 366 { 369 367 screen->Bar(m_pos, m_pos + ivec2(l - 1, h - 1), wm->black()); … … 393 391 394 392 pick_list::pick_list(int X, int Y, int ID, int height, 395 char **List, int num_entries, int start_yoffset, ifield *Next, image *texture)393 char **List, int num_entries, int start_yoffset, ifield *Next, AImage *texture) 396 394 : scroller(X,Y,ID,2,2,1,0,Next) 397 395 { … … 416 414 } 417 415 418 void pick_list::handle_inside_event(Event &ev, image *screen, InputManager *inm)416 void pick_list::handle_inside_event(Event &ev, AImage *screen, InputManager *inm) 419 417 { 420 418 if (ev.type==EV_MOUSE_MOVE && activate_on_mouse_move()) … … 462 460 } 463 461 464 void pick_list::handle_up( image *screen, InputManager *inm)462 void pick_list::handle_up(AImage *screen, InputManager *inm) 465 463 { 466 464 if (cur_sel>0) … … 476 474 } 477 475 478 void pick_list::handle_down( image *screen, InputManager *inm)476 void pick_list::handle_down(AImage *screen, InputManager *inm) 479 477 { 480 478 if (cur_sel<t-1) … … 490 488 } 491 489 492 void pick_list::scroll_event(int newx, image *screen)490 void pick_list::scroll_event(int newx, AImage *screen) 493 491 { 494 492 last_sel=newx; … … 581 579 } 582 580 583 void spicker::draw_background( image *screen)581 void spicker::draw_background(AImage *screen) 584 582 { 585 583 screen->Bar(m_pos, m_pos + ivec2(l - 1, h - 1), wm->dark_color()); … … 593 591 } 594 592 595 void spicker::set_x(int x, image *screen)593 void spicker::set_x(int x, AImage *screen) 596 594 { 597 595 cur_sel=x; … … 601 599 602 600 603 void spicker::scroll_event(int newx, image *screen)601 void spicker::scroll_event(int newx, AImage *screen) 604 602 { 605 603 last_sel=newx; … … 625 623 626 624 627 void spicker::handle_inside_event(Event &ev, image *screen, InputManager *inm)625 void spicker::handle_inside_event(Event &ev, AImage *screen, InputManager *inm) 628 626 { 629 627 switch (ev.type) … … 688 686 689 687 690 void spicker::handle_up( image *screen, InputManager *inm)688 void spicker::handle_up(AImage *screen, InputManager *inm) 691 689 { 692 690 if (vert && cur_sel>0) … … 705 703 } 706 704 707 void spicker::handle_down( image *screen, InputManager *inm)705 void spicker::handle_down(AImage *screen, InputManager *inm) 708 706 { 709 707 if (vert && cur_sel<t-1) … … 720 718 } 721 719 722 void spicker::handle_left( image *screen, InputManager *inm)723 { 724 } 725 726 void spicker::handle_right( image *screen, InputManager *inm)727 { 728 } 729 730 731 732 720 void spicker::handle_left(AImage *screen, InputManager *inm) 721 { 722 } 723 724 void spicker::handle_right(AImage *screen, InputManager *inm) 725 { 726 } 727 728 729 730 -
abuse/branches/lol/src/imlib/scroller.h
r659 r709 34 34 int wig_x(); 35 35 int darea() { return (l-bw()-2)-bw()-bw(); } 36 void draw_widget( image *screen, int erase);36 void draw_widget(AImage *screen, int erase); 37 37 int mouse_to_drag(int mx,int my); 38 38 public : … … 40 40 scroller(int X, int Y, int ID, int L, int H, int Vert, int Total_items, ifield *Next); 41 41 virtual void area(int &x1, int &y1, int &x2, int &y2); 42 virtual void draw_first( image *screen);43 virtual void draw(int active, image *screen);44 virtual void handle_event(Event &ev, image *screen, InputManager *im);42 virtual void draw_first(AImage *screen); 43 virtual void draw(int active, AImage *screen); 44 virtual void handle_event(Event &ev, AImage *screen, InputManager *im); 45 45 virtual char *read() { return (char *)&sx; } 46 46 47 47 virtual int activate_on_mouse_move() { return 1; } 48 virtual void handle_inside_event(Event &ev, image *screen, InputManager *inm) { ; }49 virtual void scroll_event(int newx, image *screen);50 virtual void handle_up( image *screen, InputManager *inm);51 virtual void handle_down( image *screen, InputManager *inm);52 virtual void handle_left( image *screen, InputManager *inm);53 virtual void handle_right( image *screen, InputManager *inm);48 virtual void handle_inside_event(Event &ev, AImage *screen, InputManager *inm) { ; } 49 virtual void scroll_event(int newx, AImage *screen); 50 virtual void handle_up(AImage *screen, InputManager *inm); 51 virtual void handle_down(AImage *screen, InputManager *inm); 52 virtual void handle_left(AImage *screen, InputManager *inm); 53 virtual void handle_right(AImage *screen, InputManager *inm); 54 54 virtual void area_config() { ; } 55 55 void set_size(int width, int height) { l=width; h=height; } 56 virtual void set_x(int x, image *screen);56 virtual void set_x(int x, AImage *screen); 57 57 } ; 58 58 … … 69 69 int get_select(int x); 70 70 int first_selected(); 71 virtual void scroll_event(int newx, image *screen);72 virtual void handle_inside_event(Event &ev, image *screen, InputManager *inm);71 virtual void scroll_event(int newx, AImage *screen); 72 virtual void handle_inside_event(Event &ev, AImage *screen, InputManager *inm); 73 73 74 74 // you should define \/ 75 virtual void draw_background( image *screen);76 virtual void draw_item( image *screen, int x, int y, int num, int active) = 0;75 virtual void draw_background(AImage *screen); 76 virtual void draw_item(AImage *screen, int x, int y, int num, int active) = 0; 77 77 virtual int total() = 0; 78 78 virtual int item_width() = 0; 79 79 virtual int item_height() = 0; 80 virtual void note_selection( image *screen, InputManager *inm, int x) { ; }81 virtual void note_new_current( image *screen, InputManager *inm, int x) { ; }80 virtual void note_selection(AImage *screen, InputManager *inm, int x) { ; } 81 virtual void note_new_current(AImage *screen, InputManager *inm, int x) { ; } 82 82 virtual int ok_to_select(int num) { return 1; } 83 virtual void handle_up( image *screen, InputManager *inm);84 virtual void handle_down( image *screen, InputManager *inm);85 virtual void handle_left( image *screen, InputManager *inm);86 virtual void handle_right( image *screen, InputManager *inm);87 virtual void set_x(int x, image *screen);83 virtual void handle_up(AImage *screen, InputManager *inm); 84 virtual void handle_down(AImage *screen, InputManager *inm); 85 virtual void handle_left(AImage *screen, InputManager *inm); 86 virtual void handle_right(AImage *screen, InputManager *inm); 87 virtual void set_x(int x, AImage *screen); 88 88 void reconfigure(); // should be called by constructor after class is ready to take virtual calls 89 89 ~spicker() { if (select) free(select); } … … 101 101 pick_list_item *lis; 102 102 char key_hist[20],key_hist_total; 103 image *tex;103 AImage *tex; 104 104 public : 105 105 pick_list(int X, int Y, int ID, int height, 106 char **List, int num_entries, int start_yoffset, ifield *Next, image *texture=NULL);107 virtual void handle_inside_event(Event &ev, image *screen, InputManager *inm);108 virtual void scroll_event(int newx, image *screen);106 char **List, int num_entries, int start_yoffset, ifield *Next, AImage *texture=NULL); 107 virtual void handle_inside_event(Event &ev, AImage *screen, InputManager *inm); 108 virtual void scroll_event(int newx, AImage *screen); 109 109 virtual char *read() { return (char *)this; } 110 110 virtual void area_config(); 111 virtual void handle_up( image *screen, InputManager *inm);112 virtual void handle_down( image *screen, InputManager *inm);111 virtual void handle_up(AImage *screen, InputManager *inm); 112 virtual void handle_down(AImage *screen, InputManager *inm); 113 113 int get_selection() { return lis[cur_sel].number; } 114 114 ~pick_list() { free(lis); } -
abuse/branches/lol/src/imlib/specs.cpp
r698 r709 36 36 "Palette", // 2 37 37 "Invalid Type", // 3 38 " Image", // 438 "AImage", // 4 39 39 "Fore Tile", 40 40 "Back Tile", … … 48 48 "Normal file", 49 49 "Compress1 file", 50 "Vector Image",50 "Vector AImage", 51 51 "Light list", 52 52 "Grue fgmap", -
abuse/branches/lol/src/imlib/sprite.cpp
r687 r709 23 23 #include "sprite.h" 24 24 25 ASprite::ASprite( image *screen, image *visual, ivec2 pos)25 ASprite::ASprite(AImage *screen, AImage *visual, ivec2 pos) 26 26 { 27 27 ASSERT(visual); … … 31 31 m_visual = visual; 32 32 m_screen = screen; 33 m_save = new image(visual->Size());33 m_save = new AImage(visual->Size()); 34 34 35 35 if (m_pos + visual->Size() >= ivec2(0) && m_pos < ivec2(xres, yres)) … … 42 42 } 43 43 44 void ASprite::SetVisual( image *visual, int delete_old)44 void ASprite::SetVisual(AImage *visual, int delete_old) 45 45 { 46 46 if (delete_old) … … 50 50 { 51 51 delete m_save; 52 m_save = new image(visual->Size());52 m_save = new AImage(visual->Size()); 53 53 } 54 54 -
abuse/branches/lol/src/imlib/sprite.h
r686 r709 18 18 { 19 19 public: 20 ASprite( image *screen, image *visual, ivec2 pos);20 ASprite(AImage *screen, AImage *visual, ivec2 pos); 21 21 ~ASprite(); 22 22 23 void SetVisual( image *visual, int delete_old = 0);23 void SetVisual(AImage *visual, int delete_old = 0); 24 24 25 image *m_visual, *m_screen, *m_save;25 AImage *m_visual, *m_screen, *m_save; 26 26 27 27 private: -
abuse/branches/lol/src/imlib/supmorph.cpp
r708 r709 201 201 } 202 202 203 smorph_player::smorph_player(super_morph *m, Palette *pal, image *i1, image *i2, int frames, int dir)203 smorph_player::smorph_player(super_morph *m, Palette *pal, AImage *i1, AImage *i2, int frames, int dir) 204 204 { 205 205 unsigned char *d = m->movers; … … 242 242 } 243 243 244 int smorph_player::show( image *screen, int x, int y, ColorFilter *fil, Palette *pal,244 int smorph_player::show(AImage *screen, int x, int y, ColorFilter *fil, Palette *pal, 245 245 int blur_threshold) 246 246 { … … 329 329 FILE *fp=fopen("art/mrphmask.spe","rb"); 330 330 SpecDir sd(fp); 331 image *h1=new image(sd.find("20 h"),fp),332 *h2=new image(sd.find("1h"),fp),333 *i1=new image(sd.find("20"),fp),334 *i2=new image(sd.find("1"),fp);331 AImage *h1=new AImage(sd.find("20 h"),fp), 332 *h2=new AImage(sd.find("1h"),fp), 333 *i1=new AImage(sd.find("20"),fp), 334 *i2=new AImage(sd.find("1"),fp); 335 335 palette *pal=new palette(sd.find(SPEC_PALETTE),fp); 336 336 color_filter *fil=new color_filter(sd.find(SPEC_COLOR_TABLE),fp); -
abuse/branches/lol/src/imlib/supmorph.h
r694 r709 36 36 public : 37 37 int w,h,f_left,t; 38 smorph_player(super_morph *m, Palette *pal, image *i1, image *i2, int frames, int dir);39 int show( image *screen, int x, int y, ColorFilter *fil, Palette *pal, int blur_threshold);38 smorph_player(super_morph *m, Palette *pal, AImage *i1, AImage *i2, int frames, int dir); 39 int show(AImage *screen, int x, int y, ColorFilter *fil, Palette *pal, int blur_threshold); 40 40 ~smorph_player() { free(hole); free(steps); } 41 41 } ; -
abuse/branches/lol/src/imlib/tools.cpp
r694 r709 44 44 } 45 45 46 void tool_picker::remap(Palette *pal, image *screen)46 void tool_picker::remap(Palette *pal, AImage *screen) 47 47 { 48 48 delete map; … … 51 51 } 52 52 53 void tool_picker::draw_item( image *screen, int x, int y, int num, int active)53 void tool_picker::draw_item(AImage *screen, int x, int y, int num, int active) 54 54 { 55 55 screen->Bar(ivec2(x, y), ivec2(x + iw - 1, y + ih - 1), -
abuse/branches/lol/src/imlib/tools.h
r707 r709 34 34 Palette *icon_palette, Palette *pal, ifield *Next); 35 35 36 virtual void draw_item( image *screen, int x, int y, int num, int active);36 virtual void draw_item(AImage *screen, int x, int y, int num, int active); 37 37 virtual int total() { return total_icons; } 38 38 virtual int item_width() { return iw; } 39 39 virtual int item_height() { return ih; } 40 virtual void note_new_current( image *screen, InputManager *inm, int x)40 virtual void note_new_current(AImage *screen, InputManager *inm, int x) 41 41 { wm->Push(Event(ids[x], NULL)); } 42 42 43 void remap(Palette *pal, image *screen);43 void remap(Palette *pal, AImage *screen); 44 44 ~tool_picker(); 45 45 } ; -
abuse/branches/lol/src/imlib/transimage.cpp
r694 r709 20 20 #include "transimage.h" 21 21 22 TransImage::TransImage( image *im, char const *name)22 TransImage::TransImage(AImage *im, char const *name) 23 23 { 24 24 m_size = im->Size(); 25 26 im->Lock();27 25 28 26 // First find out how much data to allocate … … 90 88 } 91 89 } 92 im->Unlock();93 90 } 94 91 … … 98 95 } 99 96 100 image *TransImage::ToImage()101 { 102 image *im = new image(m_size);97 AImage *TransImage::ToImage() 98 { 99 AImage *im = new AImage(m_size); 103 100 104 101 // FIXME: this is required until FILLED mode is fixed 105 im->Lock();106 102 memset(im->scan_line(0), 0, m_size.x * m_size.y); 107 im->Unlock();108 103 109 104 PutImage(im, ivec2(0)); … … 111 106 } 112 107 113 uint8_t *TransImage::ClipToLine( image *screen, ivec2 pos1, ivec2 pos2,108 uint8_t *TransImage::ClipToLine(AImage *screen, ivec2 pos1, ivec2 pos2, 114 109 ivec2 &pos, int &ysteps) 115 110 { … … 146 141 147 142 template<int N> 148 void TransImage::PutImageGeneric( image *screen, ivec2 pos, uint8_t color,149 image *blend, ivec2 bpos, uint8_t *map,143 void TransImage::PutImageGeneric(AImage *screen, ivec2 pos, uint8_t color, 144 AImage *blend, ivec2 bpos, uint8_t *map, 150 145 uint8_t *map2, int amount, int nframes, 151 146 uint8_t *tint, ColorFilter *f, Palette *pal) … … 181 176 ysteps = lol::min(ysteps, pos2.y - 1 - pos.y - 2); 182 177 183 screen->Lock();184 185 178 screen_line = screen->scan_line(pos.y) + pos.x; 186 179 int sw = screen->Size().x; … … 268 261 screen_line += sw - m_size.x; 269 262 } 270 screen->Unlock(); 271 } 272 273 void TransImage::PutImage(image *screen, ivec2 pos) 263 } 264 265 void TransImage::PutImage(AImage *screen, ivec2 pos) 274 266 { 275 267 PutImageGeneric<NORMAL>(screen, pos, 0, NULL, ivec2(0), NULL, NULL, … … 277 269 } 278 270 279 void TransImage::PutRemap( image *screen, ivec2 pos, uint8_t *map)271 void TransImage::PutRemap(AImage *screen, ivec2 pos, uint8_t *map) 280 272 { 281 273 PutImageGeneric<REMAP>(screen, pos, 0, NULL, ivec2(0), map, NULL, … … 283 275 } 284 276 285 void TransImage::PutDoubleRemap( image *screen, ivec2 pos,277 void TransImage::PutDoubleRemap(AImage *screen, ivec2 pos, 286 278 uint8_t *map, uint8_t *map2) 287 279 { … … 291 283 292 284 // Used when eg. the player teleports, or in rocket trails 293 void TransImage::PutFade( image *screen, ivec2 pos, int amount, int nframes,285 void TransImage::PutFade(AImage *screen, ivec2 pos, int amount, int nframes, 294 286 ColorFilter *f, Palette *pal) 295 287 { … … 298 290 } 299 291 300 void TransImage::PutFadeTint( image *screen, ivec2 pos, int amount, int nframes,292 void TransImage::PutFadeTint(AImage *screen, ivec2 pos, int amount, int nframes, 301 293 uint8_t *tint, ColorFilter *f, Palette *pal) 302 294 { … … 305 297 } 306 298 307 void TransImage::PutColor( image *screen, ivec2 pos, uint8_t color)299 void TransImage::PutColor(AImage *screen, ivec2 pos, uint8_t color) 308 300 { 309 301 PutImageGeneric<COLOR>(screen, pos, color, NULL, ivec2(0), NULL, NULL, … … 313 305 // This method is unused but is believed to work. 314 306 // Assumes that the blend image completely covers the transparent image. 315 void TransImage::PutBlend( image *screen, ivec2 pos, image *blend, ivec2 bpos,307 void TransImage::PutBlend(AImage *screen, ivec2 pos, AImage *blend, ivec2 bpos, 316 308 int amount, ColorFilter *f, Palette *pal) 317 309 { … … 320 312 } 321 313 322 void TransImage::PutFilled( image *screen, ivec2 pos, uint8_t color)314 void TransImage::PutFilled(AImage *screen, ivec2 pos, uint8_t color) 323 315 { 324 316 PutImageGeneric<FILLED>(screen, pos, color, NULL, ivec2(0), NULL, NULL, … … 326 318 } 327 319 328 void TransImage::PutPredator( image *screen, ivec2 pos)320 void TransImage::PutPredator(AImage *screen, ivec2 pos) 329 321 { 330 322 PutImageGeneric<PREDATOR>(screen, pos, 0, NULL, ivec2(0), NULL, NULL, … … 332 324 } 333 325 334 void TransImage::PutScanLine( image *screen, ivec2 pos, int line)326 void TransImage::PutScanLine(AImage *screen, ivec2 pos, int line) 335 327 { 336 328 PutImageGeneric<SCANLINE>(screen, pos, 0, NULL, ivec2(0), NULL, NULL, -
abuse/branches/lol/src/imlib/transimage.h
r694 r709 28 28 { 29 29 public: 30 TransImage( image *im, char const *name);30 TransImage(AImage *im, char const *name); 31 31 ~TransImage(); 32 32 … … 34 34 inline uint8_t *Data() { return m_data; } 35 35 36 image *ToImage();36 AImage *ToImage(); 37 37 38 void PutImage( image *screen, ivec2 pos);39 void PutRemap( image *screen, ivec2 pos, uint8_t *map);40 void PutDoubleRemap( image *screen, ivec2 pos, uint8_t *map, uint8_t *map2);41 void PutFade( image *screen, ivec2 pos, int amount, int nframes,38 void PutImage(AImage *screen, ivec2 pos); 39 void PutRemap(AImage *screen, ivec2 pos, uint8_t *map); 40 void PutDoubleRemap(AImage *screen, ivec2 pos, uint8_t *map, uint8_t *map2); 41 void PutFade(AImage *screen, ivec2 pos, int amount, int nframes, 42 42 ColorFilter *f, Palette *pal); 43 void PutFadeTint( image *screen, ivec2 pos, int amount, int nframes,43 void PutFadeTint(AImage *screen, ivec2 pos, int amount, int nframes, 44 44 uint8_t *tint, ColorFilter *f, Palette *pal); 45 void PutColor( image *screen, ivec2 pos, uint8_t color);46 void PutFilled( image *screen, ivec2 pos, uint8_t color);47 void PutPredator( image *screen, ivec2 pos);48 void PutBlend( image *screen, ivec2 pos, image *blend, ivec2 bpos,45 void PutColor(AImage *screen, ivec2 pos, uint8_t color); 46 void PutFilled(AImage *screen, ivec2 pos, uint8_t color); 47 void PutPredator(AImage *screen, ivec2 pos); 48 void PutBlend(AImage *screen, ivec2 pos, AImage *blend, ivec2 bpos, 49 49 int blend_amount, ColorFilter *f, Palette *pal); 50 void PutScanLine( image *screen, ivec2 pos, int line);50 void PutScanLine(AImage *screen, ivec2 pos, int line); 51 51 52 52 size_t DiskUsage(); 53 53 54 54 private: 55 uint8_t *ClipToLine( image *screen, ivec2 pos1, ivec2 pos2,55 uint8_t *ClipToLine(AImage *screen, ivec2 pos1, ivec2 pos2, 56 56 ivec2 &posy, int &ysteps); 57 57 … … 59 59 FILLED, PREDATOR, BLEND, SCANLINE }; 60 60 template<int N> 61 void PutImageGeneric( image *dest, ivec2 pos, uint8_t color,62 image *blend, ivec2 bpos,61 void PutImageGeneric(AImage *dest, ivec2 pos, uint8_t color, 62 AImage *blend, ivec2 bpos, 63 63 uint8_t *map1, uint8_t *map2, int amount, 64 64 int nframes, uint8_t *tint, -
abuse/branches/lol/src/imlib/video.cpp
r700 r709 20 20 #include "video.h" 21 21 22 void update_dirty( image *im, int xoff, int yoff)22 void update_dirty(AImage *im, int xoff, int yoff) 23 23 { 24 24 // make sure the image has the ability to contain dirty areas … … 49 49 } 50 50 51 void put_image( image * im, int x, int y)51 void put_image(AImage * im, int x, int y) 52 52 { 53 53 put_part_image(im, x, y, 0, 0, im->Size().x - 1, im->Size().y - 1); -
abuse/branches/lol/src/imlib/video.h
r708 r709 29 29 extern int xres,yres; 30 30 extern int xoff,yoff; 31 extern image *main_screen;31 extern AImage *main_screen; 32 32 33 33 void CreateScreen(int argc, char **argv); … … 35 35 void UpdateScreen(); 36 36 37 void update_dirty( image *im, int xoff=0, int yoff=0);38 void put_part_image( image *im, int x, int y, int x1, int y1, int x2, int y2);39 void put_image( image * im, int x, int y);37 void update_dirty(AImage *im, int xoff=0, int yoff=0); 38 void put_part_image(AImage *im, int x, int y, int x1, int y1, int x2, int y2); 39 void put_image(AImage * im, int x, int y); 40 40 41 void clear_put_image( image *im, int x, int y);41 void clear_put_image(AImage *im, int x, int y); 42 42 int get_vmode(); 43 43 -
abuse/branches/lol/src/imlib/visobj.h
r605 r709 18 18 { 19 19 public: 20 virtual void draw( image *screen, int x, int y, Filter *f) = 0;20 virtual void draw(AImage *screen, int x, int y, Filter *f) = 0; 21 21 virtual int width() = 0; 22 22 virtual int height() = 0; -
abuse/branches/lol/src/items.cpp
r703 r709 214 214 { 215 215 uint8_t *sl; 216 image *img = load_image(fp);216 AImage *img = load_image(fp); 217 217 218 218 // create the micro image of the fore tile by averaging the color values … … 254 254 } 255 255 } 256 micro_image = new image(ivec2(AUTOTILE_WIDTH, AUTOTILE_HEIGHT));256 micro_image = new AImage(ivec2(AUTOTILE_WIDTH, AUTOTILE_HEIGHT)); 257 257 258 258 for (l=0; l<AUTOTILE_WIDTH*AUTOTILE_HEIGHT; l++) … … 284 284 figure::figure(bFILE *fp, int type) 285 285 { 286 image *im=load_image(fp);286 AImage *im=load_image(fp); 287 287 forward=new TransImage(im,"figure data"); 288 288 im->FlipX(); -
abuse/branches/lol/src/items.h
r689 r709 34 34 public : 35 35 uint16_t next; 36 image *im;36 AImage *im; 37 37 backtile(SpecEntry *e, bFILE *fp); 38 38 backtile(bFILE *fp); … … 51 51 boundary *points; 52 52 53 image *micro_image;53 AImage *micro_image; 54 54 55 55 foretile(bFILE *fp); -
abuse/branches/lol/src/level.cpp
r695 r709 1593 1593 } 1594 1594 1595 void scale_put( image *im, image *screen, int x, int y, short new_width, short new_height);1596 1597 void Level::write_thumb_nail(bFILE *fp, image *im)1598 { 1599 image *i = new image(ivec2(160, 100 + wm->font()->Size().y * 2));1595 void scale_put(AImage *im, AImage *screen, int x, int y, short new_width, short new_height); 1596 1597 void Level::write_thumb_nail(bFILE *fp, AImage *im) 1598 { 1599 AImage *i = new AImage(ivec2(160, 100 + wm->font()->Size().y * 2)); 1600 1600 i->clear(); 1601 1601 scale_put(im,i,0,0,160,100); … … 1613 1613 fp->write_uint16(i->Size().y); 1614 1614 1615 i->Lock();1616 1615 for(int y = 0; y < i->Size().y; y++) 1617 1616 fp->write(i->scan_line(y),i->Size().x); 1618 i->Unlock();1619 1617 1620 1618 delete i; -
abuse/branches/lol/src/level.h
r691 r709 143 143 void write_objects(bFILE *fp, object_node *save_list); 144 144 void write_options(bFILE *fp); 145 void write_thumb_nail(bFILE *fp, image *im);145 void write_thumb_nail(bFILE *fp, AImage *im); 146 146 void write_cache_prof_info(); 147 147 void restart(); -
abuse/branches/lol/src/light.cpp
r706 r709 626 626 627 627 628 void light_screen( image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient)628 void light_screen(AImage *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient) 629 629 { 630 630 int lx_run=0,ly_run; // light block x & y run size in pixels == (1<<lx_run) … … 669 669 670 670 LightPatch *f=first; 671 672 main_screen->Lock();673 671 674 672 int scr_w=main_screen->Size().x; … … 765 763 screen_line-=prefix; 766 764 } 767 main_screen->Unlock();768 765 769 766 while (first) -
abuse/branches/lol/src/light.h
r704 r709 71 71 void read_lights(SpecDir *sd, bFILE *fp, char const *level_name); 72 72 73 void light_screen( image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient);73 void light_screen(AImage *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient); 74 74 75 75 void calc_light_table(Palette *pal); -
abuse/branches/lol/src/loader2.cpp
r706 r709 73 73 74 74 75 image *load_image(SpecEntry *e, bFILE *fp)76 { 77 image *im = new image(fp, e);75 AImage *load_image(SpecEntry *e, bFILE *fp) 76 { 77 AImage *im = new AImage(fp, e); 78 78 return im; 79 79 } 80 80 81 image *load_image(bFILE *fp)82 { 83 image *im = new image(fp);81 AImage *load_image(bFILE *fp) 82 { 83 AImage *im = new AImage(fp); 84 84 return im; 85 85 } … … 352 352 353 353 354 image *tmp_image = new image(ivec2(192, 104), fnt6x13); 355 big_font=new JCFont(tmp_image); 354 AImage *tmp_image = new AImage(ivec2(192, 104)); 355 memcpy(tmp_image->scan_line(0), fnt6x13, 192 * 104); 356 big_font = new JCFont(tmp_image); 356 357 delete tmp_image; 357 358 -
abuse/branches/lol/src/loader2.h
r694 r709 79 79 80 80 81 image *load_image(SpecEntry *e, bFILE *fp); // preforms scaling82 image *load_image(bFILE *fp);81 AImage *load_image(SpecEntry *e, bFILE *fp); // preforms scaling 82 AImage *load_image(bFILE *fp); 83 83 void load_data(int argc, char **argv); 84 84 char *load_script(char *name); -
abuse/branches/lol/src/loadgame.cpp
r689 r709 60 60 } 61 61 62 Jwindow *create_num_window(int mx, int total_saved, int lines, image **thumbnails)62 Jwindow *create_num_window(int mx, int total_saved, int lines, AImage **thumbnails) 63 63 { 64 64 ico_button *buts[MAX_SAVE_GAMES]; … … 167 167 { 168 168 int total_saved=0; 169 image *thumbnails[MAX_SAVE_GAMES];169 AImage *thumbnails[MAX_SAVE_GAMES]; 170 170 int start_num=0; 171 171 int max_w=160,max_h=100; 172 172 memset(thumbnails,0,sizeof(thumbnails)); 173 173 174 image *first=NULL;174 AImage *first=NULL; 175 175 176 176 for (start_num=0; start_num<MAX_SAVE_GAMES; start_num++) … … 191 191 if (se && se->type==SPEC_IMAGE) 192 192 { 193 thumbnails[start_num] = new image(fp, se);193 thumbnails[start_num] = new AImage(fp, se); 194 194 if (thumbnails[start_num]->Size().x>max_w) max_w=thumbnails[start_num]->Size().x; 195 195 if (thumbnails[start_num]->Size().y>max_h) max_h=thumbnails[start_num]->Size().y; … … 202 202 if (fail && show_all) 203 203 { 204 thumbnails[start_num] = new image(ivec2(160, 100));204 thumbnails[start_num] = new AImage(ivec2(160, 100)); 205 205 thumbnails[start_num]->clear(); 206 206 console_font->PutString(thumbnails[start_num], ivec2(0), symbol_str("no_saved")); -
abuse/branches/lol/src/menu.cpp
r707 r709 56 56 percent = 256 - percent; 57 57 58 main_screen->Lock();59 58 for (int y = aa.y; y < bb.y; y++) 60 59 { … … 68 67 } 69 68 main_screen->AddDirty(aa, bb); 70 main_screen->Unlock();71 69 } 72 70 … … 154 152 int choice=0,done=0; 155 153 int bh=font->Size().y+3; 156 image *save = new image(ivec2(mw - 2,bh));154 AImage *save = new AImage(ivec2(mw - 2,bh)); 157 155 int color=128,cdir=50; 158 156 … … 352 350 353 351 void fade_out(int steps); 354 void fade_in( image *im, int steps);352 void fade_in(AImage *im, int steps); 355 353 356 354 … … 371 369 if (DEFINEDP(ss->GetValue())) 372 370 { 373 image blank(ivec2(2, 2)); blank.clear();371 AImage blank(ivec2(2, 2)); blank.clear(); 374 372 wm->SetMouseShape(blank.copy(), ivec2(0, 0)); // don't show mouse 375 373 … … 490 488 if (title_screen>=0) 491 489 { 492 image *im = cache.img(title_screen);490 AImage *im = cache.img(title_screen); 493 491 main_screen->PutImage(im, main_screen->Size() / 2 - im->Size() / 2); 494 492 } -
abuse/branches/lol/src/morpher.cpp
r694 r709 68 68 figure *f1=t1->get_sequence(morph_pose)->get_figure(0), 69 69 *f2=t2->get_sequence(morph_pose)->get_figure(0); 70 image *i1=f1->forward->ToImage(),70 AImage *i1=f1->forward->ToImage(), 71 71 *i2=f2->forward->ToImage(); 72 72 -
abuse/branches/lol/src/netcfg.cpp
r706 r709 262 262 void net_configuration::error(char const *message) 263 263 { 264 image *screen_backup = main_screen->copy();265 266 image *ns=cache.img(cache.reg("art/frame.spe","net_screen",SPEC_IMAGE,1));264 AImage *screen_backup = main_screen->copy(); 265 266 AImage *ns=cache.img(cache.reg("art/frame.spe","net_screen",SPEC_IMAGE,1)); 267 267 int ns_w=ns->Size().x,ns_h=ns->Size().y; 268 268 int x=(xres+1)/2-ns_w/2,y=(yres+1)/2-ns_h/2; … … 329 329 int net_configuration::get_options(int server) 330 330 { 331 image *ns=cache.img(cache.reg("art/frame.spe","net_screen",SPEC_IMAGE,1));331 AImage *ns=cache.img(cache.reg("art/frame.spe","net_screen",SPEC_IMAGE,1)); 332 332 int ns_w=ns->Size().x,ns_h=ns->Size().y; 333 333 int x=(xres+1)/2-ns_w/2,y=(yres+1)/2-ns_h/2; 334 334 main_screen->PutImage(ns, ivec2(x, y)); 335 335 JCFont *fnt=wm->font(); 336 image *ok_image=cache.img(cache.reg("art/frame.spe","dev_ok",SPEC_IMAGE,1))->copy(),336 AImage *ok_image=cache.img(cache.reg("art/frame.spe","dev_ok",SPEC_IMAGE,1))->copy(), 337 337 *cancel_image=cache.img(cache.reg("art/frame.spe","cancel",SPEC_IMAGE,1))->copy(); 338 338 … … 448 448 main_screen->clear(); 449 449 450 image *ns=cache.img(cache.reg("art/frame.spe","net_screen",SPEC_IMAGE,1));450 AImage *ns=cache.img(cache.reg("art/frame.spe","net_screen",SPEC_IMAGE,1)); 451 451 int ns_w=ns->Size().x,ns_h=ns->Size().y; 452 452 int x=(xres+1)/2-ns_w/2,y=(yres+1)/2-ns_h/2; -
abuse/branches/lol/src/particle.cpp
r698 r709 163 163 } 164 164 165 void part_frame::draw( image *screen, int x, int y, int dir)165 void part_frame::draw(AImage *screen, int x, int y, int dir) 166 166 { 167 167 ivec2 caa, cbb; … … 178 178 while (i && pon->y<caa.y) { pon++; i--; } 179 179 if (!i) return ; 180 screen->Lock();181 180 if (dir>0) 182 181 { … … 200 199 } 201 200 } 202 screen->Unlock();203 201 } 204 202 … … 218 216 s = (15 - s); 219 217 220 main_screen->Lock();221 218 while(t--) 222 219 { … … 230 227 yo += dy; 231 228 } 232 main_screen->Unlock();233 229 } 234 230 … … 247 243 int ym = (1 << s); 248 244 s = (15 - s); 249 250 main_screen->Lock();251 245 252 246 int w = main_screen->Size().x; … … 271 265 yo += dy; 272 266 } 273 274 main_screen->Unlock(); 275 } 276 267 } 268 -
abuse/branches/lol/src/particle.h
r691 r709 38 38 part *data; 39 39 part_frame(bFILE *fp); 40 void draw( image *screen, int x, int y, int dir);40 void draw(AImage *screen, int x, int y, int dir); 41 41 ~part_frame(); 42 42 } ; -
abuse/branches/lol/src/sbar.h
r555 r709 32 32 33 33 void area(int &x1, int &y1, int &x2, int &y2); 34 void draw_num( image *screen, int x, int y, int num, int *offset);34 void draw_num(AImage *screen, int x, int y, int num, int *offset); 35 35 int mouse_in_area(); 36 36 public : … … 38 38 void associate(view *V) { v=V; } 39 39 void load(); // load graphics into cache 40 void redraw( image *screen);40 void redraw(AImage *screen); 41 41 42 42 void step(); 43 void draw_health( image *screen,int amount);44 void draw_ammo( image *screen, int weapon_num, int amount, int light);43 void draw_health(AImage *screen,int amount); 44 void draw_ammo(AImage *screen, int weapon_num, int amount, int light); 45 45 void need_refresh() { need_rf=1; } 46 46 void draw_update(); -
abuse/branches/lol/src/sdlport/event.cpp
r706 r709 35 35 36 36 extern int get_key_binding(char const *dir, int i); 37 extern int mouse_xscale, mouse_yscale;38 37 short mouse_buttons[5] = { 0, 0, 0, 0, 0 }; 39 40 void EventHandler::SysInit()41 {42 // Ignore activate events43 SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE);44 }45 38 46 39 void EventHandler::SysWarpMouse(ivec2 pos) -
abuse/branches/lol/src/sdlport/video.cpp
r708 r709 42 42 Array<uint8_t> g_screen; 43 43 44 image *main_screen = NULL;44 AImage *main_screen = NULL; 45 45 int mouse_xscale, mouse_yscale; 46 46 int xres, yres; … … 62 62 63 63 // Create the screen image 64 main_screen = new image(ivec2(xres, yres), NULL, 2);64 main_screen = new AImage(ivec2(xres, yres), 2); 65 65 if (main_screen == NULL) 66 66 { … … 90 90 // Draw only dirty parts of the image to screen 91 91 // 92 void put_part_image( image *im, int x, int y, int x1, int y1, int x2, int y2)92 void put_part_image(AImage *im, int x, int y, int x1, int y1, int x2, int y2) 93 93 { 94 94 int xe, ye; -
abuse/branches/lol/src/statbar.cpp
r703 r709 37 37 38 38 // defined in dev.c 39 void scale_put_trans( image *im, image *screen, int x, int y, short new_width, short new_height);40 void scale_put( image *im, image *screen, int x, int y, short new_width, short new_height);39 void scale_put_trans(AImage *im, AImage *screen, int x, int y, short new_width, short new_height); 40 void scale_put(AImage *im, AImage *screen, int x, int y, short new_width, short new_height); 41 41 42 42 void status_bar::load() … … 71 71 } 72 72 73 void status_bar::draw_num( image *screen, int x, int y, int num, int *offset)73 void status_bar::draw_num(AImage *screen, int x, int y, int num, int *offset) 74 74 { 75 75 if (num<0 || num>999) … … 79 79 } 80 80 81 image *im=cache.img(*offset);81 AImage *im=cache.img(*offset); 82 82 int dw = im->Size().x; 83 83 int dh = im->Size().y; … … 95 95 } 96 96 97 void status_bar::redraw( image *screen)97 void status_bar::redraw(AImage *screen) 98 98 { 99 99 need_rf=0; … … 104 104 if (!playing_state(the_game->state)) return ; 105 105 106 image *sb=cache.img(sbar);106 AImage *sb=cache.img(sbar); 107 107 108 108 // status bar width & height … … 174 174 } 175 175 176 image *sb=cache.img(sbar);176 AImage *sb=cache.img(sbar); 177 177 178 178 // status bar width & height … … 187 187 188 188 189 void status_bar::draw_health( image *screen,int amount)189 void status_bar::draw_health(AImage *screen,int amount) 190 190 { 191 191 if (total_weapons) … … 198 198 199 199 200 void status_bar::draw_ammo( image *screen, int weapon_num, int amount, int light)200 void status_bar::draw_ammo(AImage *screen, int weapon_num, int amount, int light) 201 201 { 202 202 if (total_weapons) … … 259 259 if (sbar>0 && total_weapons) 260 260 { 261 image *sb=cache.img(sbar);261 AImage *sb=cache.img(sbar); 262 262 263 263 // status bar width & height -
abuse/branches/lol/src/tool/abuse-tool.cpp
r698 r709 146 146 case SPEC_CHARACTER2: 147 147 { 148 image *im = new image(&fp, se);148 AImage *im = new AImage(&fp, se); 149 149 printf(" \t# %i x %i pixels", im->Size().x, im->Size().y); 150 150 delete im; … … 242 242 pal = new Palette(dir.m_entries[palid], &fp); 243 243 244 image *im = new image(&fp, dir.m_entries[imgid]);244 AImage *im = new AImage(&fp, dir.m_entries[imgid]); 245 245 write_PCX(im, pal, "/dev/stdout"); 246 246 delete im; … … 338 338 { 339 339 Palette *pal = NULL; 340 image *im = read_PCX(argv[5], pal);340 AImage *im = read_PCX(argv[5], pal); 341 341 if (!im) 342 342 { -
abuse/branches/lol/src/transp.cpp
r687 r709 17 17 #include "transp.h" 18 18 19 void transp_put( image *im, image *screen, uint8_t *table, int x, int y)19 void transp_put(AImage *im, AImage *screen, uint8_t *table, int x, int y) 20 20 { 21 21 ivec2 caa, cbb; … … 56 56 57 57 /* 58 void transp_put( image *im, image *screen, uint8_t *table, int x, int y)58 void transp_put(AImage *im, AImage *screen, uint8_t *table, int x, int y) 59 59 { 60 60 int cx1, cy1, cx2, cy2; -
abuse/branches/lol/src/transp.h
r555 r709 12 12 #define __TRANSP_HPP_ 13 13 #include "image.h" 14 void transp_put( image *im, image *screen, uint8_t *table, int x, int y);14 void transp_put(AImage *im, AImage *screen, uint8_t *table, int x, int y); 15 15 16 16 #endif -
abuse/branches/lol/src/ui/volumewindow.cpp
r694 r709 43 43 bg = cache.reg(ff, "vcontrol", SPEC_IMAGE, 1); 44 44 m_size = cache.img(bg)->Size(); 45 m_surf = new image(m_size, NULL, 2);45 m_surf = new AImage(m_size, 2); 46 46 redraw(); 47 47 }
Note: See TracChangeset
for help on using the changeset viewer.