has_color() performance fixes
Performance profiling showed that multiple strcmpi() calls were occurring each and every time a character was going to the map. This update: - honors the WC_COLOR capability - It allows a window-port to control individual color availability should the window-port wish to do so. - Makes checking on the individual colors for the active window-port is a straightforward table lookup at the CLR_ offset. iflags.use_color remains a master on/off switch for use of color, regardless of the capability compiled into the game (default TRUE). The has_color() routine, which is now a shared routine in src/windows.c, could likely be made into a simple macro to eliminate the function call, but this update does not go that far. This hits a lot of port files due to the window-port interface change, mostly cookie-cutter.
This commit is contained in:
@@ -28,7 +28,9 @@ long amii_scrnmode;
|
||||
* the intuition interface for the amiga...
|
||||
*/
|
||||
struct window_procs amii_procs = {
|
||||
"amii", WC_COLOR | WC_HILITE_PET | WC_INVERSE, 0L, amii_init_nhwindows,
|
||||
"amii", WC_COLOR | WC_HILITE_PET | WC_INVERSE,
|
||||
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */
|
||||
0L, amii_init_nhwindows,
|
||||
amii_player_selection, amii_askname, amii_get_nh_event,
|
||||
amii_exit_nhwindows, amii_suspend_nhwindows, amii_resume_nhwindows,
|
||||
amii_create_nhwindow, amii_clear_nhwindow, amii_display_nhwindow,
|
||||
@@ -60,7 +62,9 @@ struct window_procs amii_procs = {
|
||||
* a shared library to allow the executable to be smaller.
|
||||
*/
|
||||
struct window_procs amiv_procs = {
|
||||
"amitile", WC_COLOR | WC_HILITE_PET | WC_INVERSE, 0L, amii_init_nhwindows,
|
||||
"amitile", WC_COLOR | WC_HILITE_PET | WC_INVERSE,
|
||||
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */
|
||||
0L, amii_init_nhwindows,
|
||||
amii_player_selection, amii_askname, amii_get_nh_event,
|
||||
amii_exit_nhwindows, amii_suspend_nhwindows, amii_resume_nhwindows,
|
||||
amii_create_nhwindow, amii_clear_nhwindow, amii_display_nhwindow,
|
||||
|
||||
@@ -3251,7 +3251,9 @@ struct window_procs mac_procs = {
|
||||
WC_COLOR | WC_HILITE_PET | WC_FONT_MAP | WC_FONT_MENU | WC_FONT_MESSAGE
|
||||
| WC_FONT_STATUS | WC_FONT_TEXT | WC_FONTSIZ_MAP | WC_FONTSIZ_MENU
|
||||
| WC_FONTSIZ_MESSAGE | WC_FONTSIZ_STATUS | WC_FONTSIZ_TEXT,
|
||||
0L, mac_init_nhwindows,
|
||||
0L,
|
||||
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */
|
||||
mac_init_nhwindows,
|
||||
mac_unimplemented, /* see macmenu.c:mac_askname() for player selection */
|
||||
mac_askname, mac_get_nh_event, mac_exit_nhwindows, mac_suspend_nhwindows,
|
||||
mac_unimplemented, mac_create_nhwindow, mac_clear_nhwindow,
|
||||
|
||||
@@ -50,6 +50,7 @@ struct window_procs mswin_procs = {
|
||||
| WC_TILE_WIDTH | WC_TILE_HEIGHT | WC_TILE_FILE | WC_VARY_MSGCOUNT
|
||||
| WC_WINDOWCOLORS | WC_PLAYER_SELECTION,
|
||||
WC2_FULLSCREEN | WC2_SOFTKEYBOARD | WC2_WRAPTEXT, mswin_init_nhwindows,
|
||||
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */
|
||||
mswin_player_selection, mswin_askname, mswin_get_nh_event,
|
||||
mswin_exit_nhwindows, mswin_suspend_nhwindows, mswin_resume_nhwindows,
|
||||
mswin_create_nhwindow, mswin_clear_nhwindow, mswin_display_nhwindow,
|
||||
|
||||
@@ -790,6 +790,7 @@ init_ttycolor()
|
||||
}
|
||||
#endif /* TEXTCOLOR */
|
||||
|
||||
#if 0
|
||||
int
|
||||
has_color(int color)
|
||||
{
|
||||
@@ -803,6 +804,7 @@ has_color(int color)
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
term_attr_fixup(int attrmask)
|
||||
|
||||
@@ -114,12 +114,6 @@ backsp()
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
has_color(int color)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef NO_MOUSE_ALLOWED
|
||||
void
|
||||
toggle_mouse_support()
|
||||
|
||||
Reference in New Issue
Block a user