Corretto caricamento immagini
git-svn-id: svn://10.65.10.50/trunk@1237 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5f0cd593f2
commit
4523e4c068
38
ba/ba0.cpp
38
ba/ba0.cpp
@ -29,28 +29,23 @@
|
|||||||
|
|
||||||
class TPicture_mask : public TMask
|
class TPicture_mask : public TMask
|
||||||
{
|
{
|
||||||
TImage _image;
|
TImage & _image;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void handler(WINDOW win, EVENT* ep);
|
virtual void handler(WINDOW win, EVENT* ep);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TPicture_mask(const char* name, int dx, int dy, short id);
|
TPicture_mask(const char* name, int dx, int dy, TImage & image, bool remap);
|
||||||
virtual ~TPicture_mask() {}
|
virtual ~TPicture_mask() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
TPicture_mask::TPicture_mask(const char* name, int dx, int dy, short id)
|
TPicture_mask::TPicture_mask(const char* name, int dx, int dy, TImage & image, bool remap)
|
||||||
: TMask(name, 1, dx, dy), _image("")
|
: TMask(name, 1, dx, dy), _image(image)
|
||||||
{
|
{
|
||||||
char* n = format("ba%02d.bmp", id);
|
|
||||||
if (id > 0 && !fexist(n))
|
|
||||||
n = format("ba%02d.bmp", id = 0);
|
|
||||||
_image.load(n);
|
|
||||||
|
|
||||||
if (_image.ok())
|
if (_image.ok())
|
||||||
{
|
{
|
||||||
if (id == 0 && MASK_BACK_COLOR != COLOR_DKCYAN)
|
if (!remap && MASK_BACK_COLOR != COLOR_DKCYAN)
|
||||||
_image.set_clut(6, MASK_BACK_COLOR);
|
_image.set_clut(6, MASK_BACK_COLOR);
|
||||||
else
|
else
|
||||||
_image.set_palette(win());
|
_image.set_palette(win());
|
||||||
@ -100,7 +95,7 @@ class TMenu_application : public TApplication
|
|||||||
int _first[MAXLEVEL];
|
int _first[MAXLEVEL];
|
||||||
TArray _menu; // TAG|DESCRIPTION|ACTION
|
TArray _menu; // TAG|DESCRIPTION|ACTION
|
||||||
TBit_array _enabled;
|
TBit_array _enabled;
|
||||||
TArray _modules;
|
TArray _modules, _images;
|
||||||
|
|
||||||
int _level, _max;
|
int _level, _max;
|
||||||
bool _ditta_asked;
|
bool _ditta_asked;
|
||||||
@ -143,7 +138,7 @@ bool TMenu_application::build_firm_data(long codditta, bool flagcom)
|
|||||||
|
|
||||||
if (!exist)
|
if (!exist)
|
||||||
{
|
{
|
||||||
s = s.path(); s << ntrc;
|
s = s.path(); s.rtrim(1); s << ntrc;
|
||||||
exist = fexist(s);
|
exist = fexist(s);
|
||||||
}
|
}
|
||||||
if (exist)
|
if (exist)
|
||||||
@ -151,7 +146,7 @@ bool TMenu_application::build_firm_data(long codditta, bool flagcom)
|
|||||||
if (!yesno_box("Gli archivi della ditta %ld non esistono: si desidera generarli?", codditta))
|
if (!yesno_box("Gli archivi della ditta %ld non esistono: si desidera generarli?", codditta))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
set_autoload_new_files(yesno_box("Si desidera precaricare gli archivi standard"));
|
set_autoload_new_files(yesno_box("Si desidera precaricare gli archivi standard"));
|
||||||
s = s.path();
|
s = s.path(); s.rtrim(1);
|
||||||
|
|
||||||
if (!fexist(s))
|
if (!fexist(s))
|
||||||
{
|
{
|
||||||
@ -382,8 +377,19 @@ int TMenu_application::do_level()
|
|||||||
const int height = 18;
|
const int height = 18;
|
||||||
const int bwidth = 20;
|
const int bwidth = 20;
|
||||||
const int x = width-bwidth-12;
|
const int x = width-bwidth-12;
|
||||||
const short pic = (short)row.get_int();
|
short id = (short)row.get_int();
|
||||||
TPicture_mask menu(head, width, height, pic);
|
|
||||||
|
if (_images.objptr(id) == NULL)
|
||||||
|
{
|
||||||
|
char* n = format("ba%02d.bmp", id);
|
||||||
|
if (id > 0 && !fexist(n))
|
||||||
|
n = format("ba%02d.bmp", id = 0);
|
||||||
|
TImage * image = new TImage(n);
|
||||||
|
|
||||||
|
_images.add(image, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
TPicture_mask menu(head, width, height, (TImage &) _images[id], id != 0);
|
||||||
|
|
||||||
int y = 1;
|
int y = 1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user