mirror of
https://github.com/scummvm/scummvm.git
synced 2026-06-20 05:45:29 +00:00
AGS: Move Allegro color.cpp globals to Globals
This commit is contained in:
1 parent
8beec5ae7b
commit
3a3f31cd56
14 files changed
+134
-151
No files matched your search
@@ -183,9 +183,9 @@ Bitmap *convert_16_to_16bgr(Bitmap *tempbl) {
|
||||
ds = _rgb_scale_6[(c >> 5) & 0x3F];
|
||||
r = _rgb_scale_5[(c >> 11) & 0x1F];
|
||||
// allegro assumes 5-6-5 for 16-bit
|
||||
p16[x] = (((r >> _places_r) << _rgb_r_shift_16) |
|
||||
((ds >> _places_g) << _rgb_g_shift_16) |
|
||||
((b >> _places_b) << _rgb_b_shift_16));
|
||||
p16[x] = (((r >> _places_r) << _G(_rgb_r_shift_16)) |
|
||||
((ds >> _places_g) << _G(_rgb_g_shift_16)) |
|
||||
((b >> _places_b) << _G(_rgb_b_shift_16)));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,11 +50,11 @@ using namespace AGS; // FIXME later
|
||||
// were included, because they override few Allegro function names;
|
||||
// otherwise Allegro headers should not be included at all to the same
|
||||
// code unit which uses these defines.
|
||||
#define getr32(xx) ((xx >> _rgb_r_shift_32) & 0xFF)
|
||||
#define getg32(xx) ((xx >> _rgb_g_shift_32) & 0xFF)
|
||||
#define getb32(xx) ((xx >> _rgb_b_shift_32) & 0xFF)
|
||||
#define geta32(xx) ((xx >> _rgb_a_shift_32) & 0xFF)
|
||||
#define makeacol32(r,g,b,a) ((r << _rgb_r_shift_32) | (g << _rgb_g_shift_32) | (b << _rgb_b_shift_32) | (a << _rgb_a_shift_32))
|
||||
#define getr32(xx) ((xx >> _G(_rgb_r_shift_32)) & 0xFF)
|
||||
#define getg32(xx) ((xx >> _G(_rgb_g_shift_32)) & 0xFF)
|
||||
#define getb32(xx) ((xx >> _G(_rgb_b_shift_32)) & 0xFF)
|
||||
#define geta32(xx) ((xx >> _G(_rgb_a_shift_32)) & 0xFF)
|
||||
#define makeacol32(r,g,b,a) ((r << _G(_rgb_r_shift_32)) | (g << _G(_rgb_g_shift_32)) | (b << _G(_rgb_b_shift_32)) | (a << _G(_rgb_a_shift_32)))
|
||||
|
||||
|
||||
struct CachedActSpsData {
|
||||
|
||||
@@ -98,7 +98,7 @@ void script_debug(int cmdd, int dataa) {
|
||||
} else if (cmdd == 1) {
|
||||
String toDisplay = GetRuntimeInfo();
|
||||
Display(toDisplay.GetCStr());
|
||||
// Display("shftR: %d shftG: %d shftB: %d", _rgb_r_shift_16, _rgb_g_shift_16, _rgb_b_shift_16);
|
||||
// Display("shftR: %d shftG: %d shftB: %d", _G(_rgb_r_shift_16), _G(_rgb_g_shift_16), _G(_rgb_b_shift_16));
|
||||
// Display("Remaining memory: %d kb",_go32_dpmi_remaining_virtual_memory()/1024);
|
||||
//Display("Play char bcd: %d",->GetColorDepth(_GP(spriteset)[_G(views)[playerchar->view].frames[playerchar->loop][playerchar->frame].pic]));
|
||||
} else if (cmdd == 2) {
|
||||
|
||||
@@ -123,9 +123,9 @@ void Region_RunInteraction(ScriptRegion *ssr, int mood) {
|
||||
//=============================================================================
|
||||
|
||||
void generate_light_table() {
|
||||
if (_GP(game).color_depth == 1 && color_map == nullptr) {
|
||||
if (_GP(game).color_depth == 1 && _G(color_map) == nullptr) {
|
||||
create_light_table(&maincoltable, palette, 0, 0, 0, nullptr);
|
||||
color_map = &maincoltable;
|
||||
_G(color_map) = &maincoltable;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -682,7 +682,7 @@ void load_new_room(int newnum, CharacterInfo *forchar) {
|
||||
palette[ff].b = 63;
|
||||
}
|
||||
create_rgb_table(&rgb_table, palette, nullptr);
|
||||
rgb_map = &rgb_table;
|
||||
_G(rgb_map) = &rgb_table;
|
||||
}
|
||||
our_eip = 211;
|
||||
if (forchar != nullptr) {
|
||||
@@ -860,7 +860,7 @@ void load_new_room(int newnum, CharacterInfo *forchar) {
|
||||
else forchar->view = _GP(thisroom).Options.PlayerView - 1;
|
||||
forchar->frame = 0; // make him standing
|
||||
}
|
||||
color_map = nullptr;
|
||||
_G(color_map) = nullptr;
|
||||
|
||||
our_eip = 209;
|
||||
update_polled_stuff_if_runtime();
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "ags/engine/gfx/gfxdriverbase.h"
|
||||
#include "ags/engine/gfx/gfx_util.h"
|
||||
#include "ags/engine/ac/draw.h"
|
||||
#include "ags/globals.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
|
||||
@@ -179,21 +179,21 @@ void engine_pre_gfxsystem_screen_destroy() {
|
||||
// Setup color conversion parameters
|
||||
void engine_setup_color_conversions(int coldepth) {
|
||||
// default shifts for how we store the sprite data1
|
||||
_rgb_r_shift_32 = 16;
|
||||
_rgb_g_shift_32 = 8;
|
||||
_rgb_b_shift_32 = 0;
|
||||
_rgb_r_shift_16 = 11;
|
||||
_rgb_g_shift_16 = 5;
|
||||
_rgb_b_shift_16 = 0;
|
||||
_rgb_r_shift_15 = 10;
|
||||
_rgb_g_shift_15 = 5;
|
||||
_rgb_b_shift_15 = 0;
|
||||
_G(_rgb_r_shift_32) = 16;
|
||||
_G(_rgb_g_shift_32) = 8;
|
||||
_G(_rgb_b_shift_32) = 0;
|
||||
_G(_rgb_r_shift_16) = 11;
|
||||
_G(_rgb_g_shift_16) = 5;
|
||||
_G(_rgb_b_shift_16) = 0;
|
||||
_G(_rgb_r_shift_15) = 10;
|
||||
_G(_rgb_g_shift_15) = 5;
|
||||
_G(_rgb_b_shift_15) = 0;
|
||||
|
||||
// Most cards do 5-6-5 RGB, which is the format the files are saved in
|
||||
// Some do 5-6-5 BGR, or 6-5-5 RGB, in which case convert the gfx
|
||||
if ((coldepth == 16) && ((_rgb_b_shift_16 != 0) || (_rgb_r_shift_16 != 11))) {
|
||||
if ((coldepth == 16) && ((_G(_rgb_b_shift_16) != 0) || (_G(_rgb_r_shift_16) != 11))) {
|
||||
convert_16bit_bgr = 1;
|
||||
if (_rgb_r_shift_16 == 10) {
|
||||
if (_G(_rgb_r_shift_16) == 10) {
|
||||
// some very old graphics cards lie about being 16-bit when they
|
||||
// are in fact 15-bit ... get around this
|
||||
_places_r = 3;
|
||||
@@ -205,43 +205,43 @@ void engine_setup_color_conversions(int coldepth) {
|
||||
// the wrong way round - so fix that
|
||||
|
||||
#if AGS_PLATFORM_OS_IOS || AGS_PLATFORM_OS_ANDROID
|
||||
_rgb_b_shift_16 = 0;
|
||||
_rgb_g_shift_16 = 5;
|
||||
_rgb_r_shift_16 = 11;
|
||||
_G(_rgb_b_shift_16) = 0;
|
||||
_G(_rgb_g_shift_16) = 5;
|
||||
_G(_rgb_r_shift_16) = 11;
|
||||
|
||||
_rgb_b_shift_15 = 0;
|
||||
_rgb_g_shift_15 = 5;
|
||||
_rgb_r_shift_15 = 10;
|
||||
_G(_rgb_b_shift_15) = 0;
|
||||
_G(_rgb_g_shift_15) = 5;
|
||||
_G(_rgb_r_shift_15) = 10;
|
||||
|
||||
_rgb_r_shift_32 = 0;
|
||||
_rgb_g_shift_32 = 8;
|
||||
_rgb_b_shift_32 = 16;
|
||||
_G(_rgb_r_shift_32) = 0;
|
||||
_G(_rgb_g_shift_32) = 8;
|
||||
_G(_rgb_b_shift_32) = 16;
|
||||
#else
|
||||
_rgb_r_shift_16 = 11;
|
||||
_rgb_g_shift_16 = 5;
|
||||
_rgb_b_shift_16 = 0;
|
||||
_G(_rgb_r_shift_16) = 11;
|
||||
_G(_rgb_g_shift_16) = 5;
|
||||
_G(_rgb_b_shift_16) = 0;
|
||||
#endif
|
||||
} else if (coldepth == 16) {
|
||||
// ensure that any 32-bit graphics displayed are converted
|
||||
// properly to the current depth
|
||||
_rgb_r_shift_32 = 16;
|
||||
_rgb_g_shift_32 = 8;
|
||||
_rgb_b_shift_32 = 0;
|
||||
_G(_rgb_r_shift_32) = 16;
|
||||
_G(_rgb_g_shift_32) = 8;
|
||||
_G(_rgb_b_shift_32) = 0;
|
||||
} else if (coldepth < 16) {
|
||||
// ensure that any 32-bit graphics displayed are converted
|
||||
// properly to the current depth
|
||||
#if AGS_PLATFORM_OS_WINDOWS
|
||||
_rgb_r_shift_32 = 16;
|
||||
_rgb_g_shift_32 = 8;
|
||||
_rgb_b_shift_32 = 0;
|
||||
_G(_rgb_r_shift_32) = 16;
|
||||
_G(_rgb_g_shift_32) = 8;
|
||||
_G(_rgb_b_shift_32) = 0;
|
||||
#else
|
||||
_rgb_r_shift_32 = 0;
|
||||
_rgb_g_shift_32 = 8;
|
||||
_rgb_b_shift_32 = 16;
|
||||
_G(_rgb_r_shift_32) = 0;
|
||||
_G(_rgb_g_shift_32) = 8;
|
||||
_G(_rgb_b_shift_32) = 16;
|
||||
|
||||
_rgb_b_shift_15 = 0;
|
||||
_rgb_g_shift_15 = 5;
|
||||
_rgb_r_shift_15 = 10;
|
||||
_G(_rgb_b_shift_15) = 0;
|
||||
_G(_rgb_g_shift_15) = 5;
|
||||
_G(_rgb_r_shift_15) = 10;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+29
-4
@@ -31,6 +31,7 @@
|
||||
#include "ags/lib/std/array.h"
|
||||
#include "ags/lib/std/set.h"
|
||||
#include "ags/lib/allegro/fixed.h"
|
||||
#include "ags/lib/allegro/aintern.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
@@ -87,6 +88,7 @@ struct CCInventory;
|
||||
struct CCObject;
|
||||
struct CCRegion;
|
||||
struct CharacterCache;
|
||||
struct COLOR_MAP;
|
||||
struct DirtyRects;
|
||||
struct ExecutingScript;
|
||||
struct GameFrameSetup;
|
||||
@@ -99,6 +101,7 @@ struct MoveList;
|
||||
struct NonBlockingScriptFunction;
|
||||
struct ObjectCache;
|
||||
struct ResourcePaths;
|
||||
struct RGB_MAP;
|
||||
struct RoomCameraDrawData;
|
||||
struct RoomStatus;
|
||||
struct RuntimeScriptValue;
|
||||
@@ -121,13 +124,31 @@ struct ViewStruct;
|
||||
class Globals {
|
||||
public:
|
||||
/**
|
||||
* \defgroup Overall flags
|
||||
* \defgroup Allegro globals
|
||||
* @{
|
||||
*/
|
||||
|
||||
// Major overall flags
|
||||
bool _want_exit = false;
|
||||
bool _abort_engine = false;
|
||||
int __rgb_r_shift_15 = DEFAULT_RGB_R_SHIFT_15; /* truecolor pixel format */
|
||||
int __rgb_g_shift_15 = DEFAULT_RGB_G_SHIFT_15;
|
||||
int __rgb_b_shift_15 = DEFAULT_RGB_B_SHIFT_15;
|
||||
int __rgb_r_shift_16 = DEFAULT_RGB_R_SHIFT_16;
|
||||
int __rgb_g_shift_16 = DEFAULT_RGB_G_SHIFT_16;
|
||||
int __rgb_b_shift_16 = DEFAULT_RGB_B_SHIFT_16;
|
||||
int __rgb_r_shift_24 = DEFAULT_RGB_R_SHIFT_24;
|
||||
int __rgb_g_shift_24 = DEFAULT_RGB_G_SHIFT_24;
|
||||
int __rgb_b_shift_24 = DEFAULT_RGB_B_SHIFT_24;
|
||||
int __rgb_r_shift_32 = DEFAULT_RGB_R_SHIFT_32;
|
||||
int __rgb_g_shift_32 = DEFAULT_RGB_G_SHIFT_32;
|
||||
int __rgb_b_shift_32 = DEFAULT_RGB_B_SHIFT_32;
|
||||
int __rgb_a_shift_32 = DEFAULT_RGB_A_SHIFT_32;
|
||||
|
||||
RGB_MAP *_rgb_map;
|
||||
COLOR_MAP *_color_map;
|
||||
int _trans_blend_alpha = 0;
|
||||
int _trans_blend_red = 0;
|
||||
int _trans_blend_green = 0;
|
||||
int _trans_blend_blue = 0;
|
||||
BlenderMode __blender_mode = kRgbToRgbBlender;
|
||||
|
||||
/**@}*/
|
||||
|
||||
@@ -339,6 +360,10 @@ public:
|
||||
AGS::Shared::String _saveGameParent;
|
||||
AGS::Shared::String _saveGameSuffix;
|
||||
|
||||
// Major overall flags
|
||||
bool _want_exit = false;
|
||||
bool _abort_engine = false;
|
||||
|
||||
/**@}*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
*/
|
||||
|
||||
#include "ags/lib/aastr-0.1.1/aautil.h"
|
||||
#include "ags/globals.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
@@ -56,9 +57,9 @@ static struct {
|
||||
* Prepare offsets for direct access to 24bpp bitmap.
|
||||
*/
|
||||
void _aa_prepare_for_24bpp() {
|
||||
_aa.roffset24 = _rgb_r_shift_24 / 8;
|
||||
_aa.goffset24 = _rgb_g_shift_24 / 8;
|
||||
_aa.boffset24 = _rgb_b_shift_24 / 8;
|
||||
_aa.roffset24 = _G(_rgb_r_shift_24) / 8;
|
||||
_aa.goffset24 = _G(_rgb_g_shift_24) / 8;
|
||||
_aa.boffset24 = _G(_rgb_b_shift_24) / 8;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "ags/lib/allegro/aintern.h"
|
||||
#include "ags/shared/core/types.h"
|
||||
#include "ags/shared/util/stream.h"
|
||||
#include "ags/globals.h"
|
||||
#include "common/textconsole.h"
|
||||
#include "common/system.h"
|
||||
#include "graphics/palette.h"
|
||||
@@ -33,28 +34,6 @@ namespace AGS3 {
|
||||
|
||||
#define VGA_COLOR_TRANS(x) ((x) * 255 / 63)
|
||||
|
||||
int _rgb_r_shift_15 = DEFAULT_RGB_R_SHIFT_15; /* truecolor pixel format */
|
||||
int _rgb_g_shift_15 = DEFAULT_RGB_G_SHIFT_15;
|
||||
int _rgb_b_shift_15 = DEFAULT_RGB_B_SHIFT_15;
|
||||
int _rgb_r_shift_16 = DEFAULT_RGB_R_SHIFT_16;
|
||||
int _rgb_g_shift_16 = DEFAULT_RGB_G_SHIFT_16;
|
||||
int _rgb_b_shift_16 = DEFAULT_RGB_B_SHIFT_16;
|
||||
int _rgb_r_shift_24 = DEFAULT_RGB_R_SHIFT_24;
|
||||
int _rgb_g_shift_24 = DEFAULT_RGB_G_SHIFT_24;
|
||||
int _rgb_b_shift_24 = DEFAULT_RGB_B_SHIFT_24;
|
||||
int _rgb_r_shift_32 = DEFAULT_RGB_R_SHIFT_32;
|
||||
int _rgb_g_shift_32 = DEFAULT_RGB_G_SHIFT_32;
|
||||
int _rgb_b_shift_32 = DEFAULT_RGB_B_SHIFT_32;
|
||||
int _rgb_a_shift_32 = DEFAULT_RGB_A_SHIFT_32;
|
||||
|
||||
RGB_MAP *rgb_map;
|
||||
COLOR_MAP *color_map;
|
||||
int trans_blend_alpha = 0;
|
||||
int trans_blend_red = 0;
|
||||
int trans_blend_green = 0;
|
||||
int trans_blend_blue = 0;
|
||||
BlenderMode _blender_mode = kRgbToRgbBlender;
|
||||
|
||||
void color::readFromFile(AGS::Shared::Stream *file) {
|
||||
r = file->ReadByte();
|
||||
g = file->ReadByte();
|
||||
@@ -86,34 +65,34 @@ void set_palette_range(const PALETTE p, int from, int to, int retracesync) {
|
||||
}
|
||||
|
||||
int makecol15(int r, int g, int b) {
|
||||
return (((r >> 3) << _rgb_r_shift_15) |
|
||||
((g >> 3) << _rgb_g_shift_15) |
|
||||
((b >> 3) << _rgb_b_shift_15));
|
||||
return (((r >> 3) << _G(_rgb_r_shift_15)) |
|
||||
((g >> 3) << _G(_rgb_g_shift_15)) |
|
||||
((b >> 3) << _G(_rgb_b_shift_15)));
|
||||
}
|
||||
|
||||
int makecol16(int r, int g, int b) {
|
||||
return (((r >> 3) << _rgb_r_shift_16) |
|
||||
((g >> 2) << _rgb_g_shift_16) |
|
||||
((b >> 3) << _rgb_b_shift_16));
|
||||
return (((r >> 3) << _G(_rgb_r_shift_16)) |
|
||||
((g >> 2) << _G(_rgb_g_shift_16)) |
|
||||
((b >> 3) << _G(_rgb_b_shift_16)));
|
||||
}
|
||||
|
||||
int makecol24(int r, int g, int b) {
|
||||
return ((r << _rgb_r_shift_24) |
|
||||
(g << _rgb_g_shift_24) |
|
||||
(b << _rgb_b_shift_24));
|
||||
return ((r << _G(_rgb_r_shift_24)) |
|
||||
(g << _G(_rgb_g_shift_24)) |
|
||||
(b << _G(_rgb_b_shift_24)));
|
||||
}
|
||||
|
||||
int makecol32(int r, int g, int b) {
|
||||
return ((r << _rgb_r_shift_32) |
|
||||
(g << _rgb_g_shift_32) |
|
||||
(b << _rgb_b_shift_32));
|
||||
return ((r << _G(_rgb_r_shift_32)) |
|
||||
(g << _G(_rgb_g_shift_32)) |
|
||||
(b << _G(_rgb_b_shift_32)));
|
||||
}
|
||||
|
||||
int makeacol32(int r, int g, int b, int a) {
|
||||
return ((r << _rgb_r_shift_32) |
|
||||
(g << _rgb_g_shift_32) |
|
||||
(b << _rgb_b_shift_32) |
|
||||
(a << _rgb_a_shift_32));
|
||||
return ((r << _G(_rgb_r_shift_32)) |
|
||||
(g << _G(_rgb_g_shift_32)) |
|
||||
(b << _G(_rgb_b_shift_32)) |
|
||||
(a << _G(_rgb_a_shift_32)));
|
||||
}
|
||||
|
||||
int getr8(int c) {
|
||||
@@ -129,55 +108,55 @@ int getb8(int c) {
|
||||
}
|
||||
|
||||
int getr15(int c) {
|
||||
return _rgb_scale_5[(c >> _rgb_r_shift_15) & 0x1F];
|
||||
return _rgb_scale_5[(c >> _G(_rgb_r_shift_15)) & 0x1F];
|
||||
}
|
||||
|
||||
int getg15(int c) {
|
||||
return _rgb_scale_5[(c >> _rgb_g_shift_15) & 0x1F];
|
||||
return _rgb_scale_5[(c >> _G(_rgb_g_shift_15)) & 0x1F];
|
||||
}
|
||||
|
||||
int getb15(int c) {
|
||||
return _rgb_scale_5[(c >> _rgb_b_shift_15) & 0x1F];
|
||||
return _rgb_scale_5[(c >> _G(_rgb_b_shift_15)) & 0x1F];
|
||||
}
|
||||
|
||||
int getr16(int c) {
|
||||
return _rgb_scale_5[(c >> _rgb_r_shift_16) & 0x1F];
|
||||
return _rgb_scale_5[(c >> _G(_rgb_r_shift_16)) & 0x1F];
|
||||
}
|
||||
|
||||
int getg16(int c) {
|
||||
return _rgb_scale_6[(c >> _rgb_g_shift_16) & 0x3F];
|
||||
return _rgb_scale_6[(c >> _G(_rgb_g_shift_16)) & 0x3F];
|
||||
}
|
||||
|
||||
int getb16(int c) {
|
||||
return _rgb_scale_5[(c >> _rgb_b_shift_16) & 0x1F];
|
||||
return _rgb_scale_5[(c >> _G(_rgb_b_shift_16)) & 0x1F];
|
||||
}
|
||||
|
||||
int getr24(int c) {
|
||||
return ((c >> _rgb_r_shift_24) & 0xFF);
|
||||
return ((c >> _G(_rgb_r_shift_24)) & 0xFF);
|
||||
}
|
||||
|
||||
int getg24(int c) {
|
||||
return ((c >> _rgb_g_shift_24) & 0xFF);
|
||||
return ((c >> _G(_rgb_g_shift_24)) & 0xFF);
|
||||
}
|
||||
|
||||
int getb24(int c) {
|
||||
return ((c >> _rgb_b_shift_24) & 0xFF);
|
||||
return ((c >> _G(_rgb_b_shift_24)) & 0xFF);
|
||||
}
|
||||
|
||||
int getr32(int c) {
|
||||
return ((c >> _rgb_r_shift_32) & 0xFF);
|
||||
return ((c >> _G(_rgb_r_shift_32)) & 0xFF);
|
||||
}
|
||||
|
||||
int getg32(int c) {
|
||||
return ((c >> _rgb_g_shift_32) & 0xFF);
|
||||
return ((c >> _G(_rgb_g_shift_32)) & 0xFF);
|
||||
}
|
||||
|
||||
int getb32(int c) {
|
||||
return ((c >> _rgb_b_shift_32) & 0xFF);
|
||||
return ((c >> _G(_rgb_b_shift_32)) & 0xFF);
|
||||
}
|
||||
|
||||
int geta32(int c) {
|
||||
return ((c >> _rgb_a_shift_32) & 0xFF);
|
||||
return ((c >> _G(_rgb_a_shift_32)) & 0xFF);
|
||||
}
|
||||
|
||||
int makecol(byte r, byte g, byte b) {
|
||||
@@ -223,11 +202,11 @@ void unselect_palette(void) {
|
||||
}
|
||||
|
||||
void set_blender_mode(BlenderMode m, int r, int g, int b, int a) {
|
||||
_blender_mode = m;
|
||||
trans_blend_alpha = a;
|
||||
trans_blend_red = r;
|
||||
trans_blend_green = g;
|
||||
trans_blend_blue = b;
|
||||
_G(_blender_mode) = m;
|
||||
_G(trans_blend_alpha) = a;
|
||||
_G(trans_blend_red) = r;
|
||||
_G(trans_blend_green) = g;
|
||||
_G(trans_blend_blue) = b;
|
||||
}
|
||||
|
||||
void set_alpha_blender(void) {
|
||||
@@ -498,12 +477,12 @@ int bestfit_color(AL_CONST PALETTE pal, int r, int g, int b) {
|
||||
|
||||
/* makecol8:
|
||||
* Converts R, G, and B values (ranging 0-255) to an 8 bit paletted color.
|
||||
* If the global rgb_map table is initialised, it uses that, otherwise
|
||||
* If the global _G(rgb_map) table is initialised, it uses that, otherwise
|
||||
* it searches through the current palette to find the best match.
|
||||
*/
|
||||
int makecol8(int r, int g, int b) {
|
||||
if (rgb_map)
|
||||
return rgb_map->data[r >> 3][g >> 3][b >> 3];
|
||||
if (_G(rgb_map))
|
||||
return _G(rgb_map)->data[r >> 3][g >> 3][b >> 3];
|
||||
else
|
||||
return bestfit_color(_current_palette, r >> 2, g >> 2, b >> 2);
|
||||
}
|
||||
@@ -840,7 +819,7 @@ void create_light_table(COLOR_MAP *table, AL_CONST PALETTE pal, int r, int g, in
|
||||
assert(g >= 0 && g <= 63);
|
||||
assert(b >= 0 && b <= 63);
|
||||
|
||||
if (rgb_map) {
|
||||
if (_G(rgb_map)) {
|
||||
for (x = 0; x < PAL_SIZE - 1; x++) {
|
||||
t1 = x * 0x010101;
|
||||
t2 = 0xFFFFFF - t1;
|
||||
@@ -854,7 +833,7 @@ void create_light_table(COLOR_MAP *table, AL_CONST PALETTE pal, int r, int g, in
|
||||
g2 = (g1 + pal[y].g * t1) >> 25;
|
||||
b2 = (b1 + pal[y].b * t1) >> 25;
|
||||
|
||||
table->data[x][y] = rgb_map->data[r2][g2][b2];
|
||||
table->data[x][y] = _G(rgb_map)->data[r2][g2][b2];
|
||||
}
|
||||
}
|
||||
if (callback)
|
||||
@@ -919,7 +898,7 @@ void create_trans_table(COLOR_MAP *table, AL_CONST PALETTE pal, int r, int g, in
|
||||
if (b > 128)
|
||||
b++;
|
||||
|
||||
if (rgb_map)
|
||||
if (_G(rgb_map))
|
||||
add = 255;
|
||||
else
|
||||
add = 127;
|
||||
@@ -938,12 +917,12 @@ void create_trans_table(COLOR_MAP *table, AL_CONST PALETTE pal, int r, int g, in
|
||||
p = table->data[x];
|
||||
q = tmp;
|
||||
|
||||
if (rgb_map) {
|
||||
if (_G(rgb_map)) {
|
||||
for (y = 0; y < PAL_SIZE; y++) {
|
||||
tr = (i + *(q++)) >> 9;
|
||||
tg = (j + *(q++)) >> 9;
|
||||
tb = (k + *(q++)) >> 9;
|
||||
p[y] = rgb_map->data[tr][tg][tb];
|
||||
p[y] = _G(rgb_map)->data[tr][tg][tb];
|
||||
}
|
||||
} else {
|
||||
for (y = 0; y < PAL_SIZE; y++) {
|
||||
|
||||
@@ -75,13 +75,6 @@ AL_VAR(PALETTE, black_palette);
|
||||
AL_VAR(PALETTE, desktop_palette);
|
||||
AL_VAR(PALETTE, default_palette);
|
||||
|
||||
AL_VAR(RGB_MAP *, rgb_map);
|
||||
AL_VAR(COLOR_MAP *, color_map);
|
||||
extern int trans_blend_alpha;
|
||||
extern int trans_blend_red;
|
||||
extern int trans_blend_green;
|
||||
extern int trans_blend_blue;
|
||||
|
||||
enum BlenderMode {
|
||||
kSourceAlphaBlender,
|
||||
kArgbToArgbBlender,
|
||||
@@ -95,26 +88,8 @@ enum BlenderMode {
|
||||
kTintLightBlenderMode
|
||||
};
|
||||
|
||||
extern BlenderMode _blender_mode;
|
||||
|
||||
AL_VAR(PALETTE, _current_palette);
|
||||
|
||||
extern int _rgb_r_shift_15;
|
||||
extern int _rgb_g_shift_15;
|
||||
extern int _rgb_b_shift_15;
|
||||
extern int _rgb_r_shift_16;
|
||||
extern int _rgb_g_shift_16;
|
||||
extern int _rgb_b_shift_16;
|
||||
extern int _rgb_r_shift_24;
|
||||
extern int _rgb_g_shift_24;
|
||||
extern int _rgb_b_shift_24;
|
||||
extern int _rgb_r_shift_32;
|
||||
extern int _rgb_g_shift_32;
|
||||
extern int _rgb_b_shift_32;
|
||||
extern int _rgb_a_shift_32;
|
||||
|
||||
AL_ARRAY(int, _rgb_scale_5);
|
||||
AL_ARRAY(int, _rgb_scale_6);
|
||||
AL_ARRAY(const int, _rgb_scale_5);
|
||||
AL_ARRAY(const int, _rgb_scale_6);
|
||||
|
||||
AL_FUNC(void, set_color, (int idx, AL_CONST RGB *p));
|
||||
AL_FUNC(void, set_palette, (AL_CONST PALETTE p));
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "ags/lib/allegro/color.h"
|
||||
#include "ags/lib/allegro/flood.h"
|
||||
#include "ags/ags.h"
|
||||
#include "ags/globals.h"
|
||||
#include "common/textconsole.h"
|
||||
#include "graphics/screen.h"
|
||||
|
||||
@@ -146,13 +147,13 @@ void stretch_sprite(BITMAP *bmp, const BITMAP *sprite, int x, int y, int w, int
|
||||
void draw_trans_sprite(BITMAP *bmp, const BITMAP *sprite, int x, int y) {
|
||||
bmp->draw(sprite, Common::Rect(0, 0, sprite->w, sprite->h),
|
||||
Common::Rect(x, y, x + sprite->w, y + sprite->h),
|
||||
false, false, true, trans_blend_alpha);
|
||||
false, false, true, _G(trans_blend_alpha));
|
||||
}
|
||||
|
||||
void draw_lit_sprite(BITMAP *bmp, const BITMAP *sprite, int x, int y, int color) {
|
||||
bmp->draw(sprite, Common::Rect(0, 0, sprite->w, sprite->h),
|
||||
Common::Rect(x, y, x + sprite->w, y + sprite->h),
|
||||
false, false, true, color, trans_blend_red, trans_blend_green, trans_blend_blue);
|
||||
false, false, true, color, _G(trans_blend_red), _G(trans_blend_green), _G(trans_blend_blue));
|
||||
}
|
||||
|
||||
void draw_sprite_h_flip(BITMAP *bmp, const BITMAP *sprite, int x, int y) {
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace AGS3 {
|
||||
int _color_depth;
|
||||
|
||||
/* lookup table for scaling 5 bit colors up to 8 bits */
|
||||
int _rgb_scale_5[32] = {
|
||||
const int _rgb_scale_5[32] = {
|
||||
0, 8, 16, 24, 33, 41, 49, 57,
|
||||
66, 74, 82, 90, 99, 107, 115, 123,
|
||||
132, 140, 148, 156, 165, 173, 181, 189,
|
||||
@@ -37,7 +37,7 @@ int _rgb_scale_5[32] = {
|
||||
|
||||
|
||||
/* lookup table for scaling 6 bit colors up to 8 bits */
|
||||
int _rgb_scale_6[64] = {
|
||||
const int _rgb_scale_6[64] = {
|
||||
0, 4, 8, 12, 16, 20, 24, 28,
|
||||
32, 36, 40, 44, 48, 52, 56, 60,
|
||||
65, 69, 73, 77, 81, 85, 89, 93,
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "ags/lib/allegro/color.h"
|
||||
#include "ags/lib/allegro/flood.h"
|
||||
#include "ags/ags.h"
|
||||
#include "ags/globals.h"
|
||||
#include "common/textconsole.h"
|
||||
#include "graphics/screen.h"
|
||||
|
||||
@@ -215,7 +216,7 @@ void BITMAP::blendPixel(uint8 aSrc, uint8 rSrc, uint8 gSrc, uint8 bSrc, uint8 &a
|
||||
bDest = bSrc;
|
||||
return;
|
||||
}
|
||||
switch(_blender_mode) {
|
||||
switch(_G(_blender_mode)) {
|
||||
case kSourceAlphaBlender:
|
||||
blendSourceAlpha(aSrc, rSrc, gSrc, bSrc, aDest, rDest, gDest, bDest, alpha);
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user