1 | /* |
---|
2 | * Abuse - dark 2D side-scrolling platform game |
---|
3 | * Copyright (c) 1995 Crack dot Com |
---|
4 | * |
---|
5 | * This software was released into the Public Domain. As with most public |
---|
6 | * domain software, no warranty is made or implied by Crack dot Com or |
---|
7 | * Jonathan Clark. |
---|
8 | */ |
---|
9 | |
---|
10 | #include "config.h" |
---|
11 | |
---|
12 | #include "tools.h" |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | tool_picker::~tool_picker() |
---|
17 | { delete old_pal; |
---|
18 | delete map; |
---|
19 | for (int i=0;i<total_icons;i++) |
---|
20 | delete icons[i]; // delete visual object, which should be a "shell" |
---|
21 | } |
---|
22 | |
---|
23 | void tool_picker::remap(palette *pal, image *screen) |
---|
24 | { |
---|
25 | delete map; |
---|
26 | map=new filter(old_pal,pal); |
---|
27 | draw_first(screen); |
---|
28 | } |
---|
29 | |
---|
30 | tool_picker::tool_picker(int X, int Y, int ID, |
---|
31 | int show_h, visual_object **Icons, int *Ids, int total_ic, |
---|
32 | palette *icon_palette, palette *pal, ifield *Next) : |
---|
33 | spicker(X,Y,ID,show_h,1,1,0,Next) |
---|
34 | { |
---|
35 | iw=ih=0; |
---|
36 | icons=Icons; |
---|
37 | ids=Ids; |
---|
38 | total_icons=total_ic; |
---|
39 | for (int i=0;i<total_ic;i++) |
---|
40 | { |
---|
41 | if (icons[i]->width()>iw) iw=icons[i]->width(); |
---|
42 | if (icons[i]->height()>ih) ih=icons[i]->height(); |
---|
43 | } |
---|
44 | map=new filter(icon_palette,pal); |
---|
45 | old_pal=icon_palette->copy(); |
---|
46 | reconfigure(); |
---|
47 | } |
---|
48 | |
---|
49 | void tool_picker::draw_item(image *screen, int x, int y, int num, int active) |
---|
50 | { |
---|
51 | if (!active) |
---|
52 | screen->bar(x,y,x+iw-1,y+ih-1,wm->black()); |
---|
53 | else |
---|
54 | screen->bar(x,y,x+iw-1,y+ih-1,wm->bright_color()); |
---|
55 | icons[num]->draw(screen,x,y,map); |
---|
56 | } |
---|
57 | |
---|