Beispiel #1
0
REGISTER_FILE
#include "melee/mview.h"

#include "util/pmask.h"
#include "util/aastr.h"

#include <stdio.h>
#include <string.h>

#include "planet3d.h"

SpaceSprite::SpaceSprite(BITMAP *image, int _attributes)
{
	STACKTRACE;
	if (_attributes == -1)
		_attributes = string_to_sprite_attributes(NULL);
	general_attributes = _attributes;

	int i;
	BITMAP *bmp;
	count = 1;

	references = 0;
	highest_mip = 0;
	for (i = 1; i < MAX_MIP_LEVELS; i += 1) {
		b[i] = NULL;
	}

	bpp = 32;					 //videosystem.bpp;

	m = new PMASK* [count];
	b[0] = new BITMAP*[count];
	attributes = new char [count];

	w = image->w;
	h = image->h;

	bmp = create_bitmap_ex ( bpp, w, h);
	convert_bitmap(image, bmp, general_attributes & MASKED);

	i = 0;
	color_correct_bitmap(bmp, general_attributes & MASKED);
	m[i] = create_allegro_pmask(bmp);
	b[0][i] = bmp;
	attributes[i] = DEALLOCATE_IMAGE | DEALLOCATE_MASK;
}
Beispiel #2
0
int my_list_proc( int msg, DIALOG* d, int c )
{
    STACKTRACE;
    int old_d1 = d->d1;
    Fleet *fleet = (Fleet*)d->dp3;
    int ret = d_list_proc2( msg, d, c );
    if ( d->d1 != old_d1 || msg == MSG_START ) {
        ShipType* type = fleet->getShipType(d->d1);

        ASSERT(type != NULL);

        selectDialog[SELECT_DIALOG_TITLE].flags |= D_DIRTY;
        sprintf(selectTitleString, "%s\n%s\n%d of %d points",
                selectShipPrompt,
                (type != NULL) ? type->name : 0,
                (type != NULL) ? type->cost : 0,
                fleet->getCost());

        BITMAP* panel = NULL;
        TW_DATAFILE* data = tw_load_datafile_object( type->data->file, "SHIP_P00_PCX" );

        if ( data ) {
            BITMAP* bmp = (BITMAP*)data->dat;
            panel = create_bitmap_ex( bitmap_color_depth(screen), bmp->w, bmp->h );
            blit( bmp, panel, 0, 0, 0, 0, bmp->w, bmp->h );
            tw_unload_datafile_object( data );
            data = tw_load_datafile_object( type->data->file, "SHIP_P01_PCX" );
            bmp = (BITMAP*)data->dat;
            blit( bmp, panel, 0, 0, 4, 65, bmp->w, bmp->h );
            tw_unload_datafile_object( data );
            color_correct_bitmap( panel, 0 );
        }

        if ( selectDialog[SELECT_DIALOG_PIC].dp ) destroy_bitmap( (BITMAP*)selectDialog[SELECT_DIALOG_PIC].dp );
        selectDialog[SELECT_DIALOG_PIC].dp = panel;
        scare_mouse();
        SEND_MESSAGE( &selectDialog[SELECT_DIALOG_PIC], MSG_DRAW, 0 );
        unscare_mouse();
    }
    return ret;
}