Esempio n. 1
0
static void GUI_Security_DrawText(char *text)
{
	Screen oldScreenID;

	oldScreenID = GFX_Screen_SetActive(SCREEN_2);

	GUI_Mouse_Hide_InRegion(0, 0, SCREEN_WIDTH, 40);
	GUI_Screen_Copy(0, 0, 0, 0, SCREEN_WIDTH / 8, 40, SCREEN_0, SCREEN_2);
	GUI_Mouse_Show_InRegion();

	GUI_Screen_Copy(0, 0, 0, 160, SCREEN_WIDTH / 8, 40, SCREEN_2, SCREEN_2);

	GUI_Mentat_SplitText(text, 304);

	GUI_DrawText_Wrapper(text, 4, 1, g_curWidgetFGColourBlink, 0, 0x32);

	GUI_Mouse_Hide_InRegion(0, 0, SCREEN_WIDTH, 40);
	GUI_Screen_Copy(0, 0, 0, 0, SCREEN_WIDTH / 8, 40, SCREEN_2, SCREEN_0);
	GUI_Mouse_Show_InRegion();

	GFX_Screen_SetActive(oldScreenID);
}
Esempio n. 2
0
/**
 * Draw a text button widget to the display, relative to its parent.
 *
 * @param w The widget (which is a button) to draw.
 */
void GUI_Widget_TextButton_Draw(Widget *w)
{
	Screen oldScreenID;
	uint16 positionX, positionY;
	uint16 width, height;
	uint16 state;
	uint8 colour;

	if (w == NULL) return;

	oldScreenID = GFX_Screen_SetActive(SCREEN_1);

	positionX = w->offsetX + (g_widgetProperties[w->parentID].xBase << 3);
	positionY = w->offsetY +  g_widgetProperties[w->parentID].yBase;
	width     = w->width;
	height    = w->height;

	g_widgetProperties[19].xBase  = positionX >> 3;
	g_widgetProperties[19].yBase  = positionY;
	g_widgetProperties[19].width  = width >> 3;
	g_widgetProperties[19].height = height;

	state  = (w->state.s.selected) ? 0 : 2;
	colour = (w->state.s.hover2) ? 231 : 232;

	GUI_Widget_DrawBorder(19, state, 1);

	if (w->stringID == STR_CANCEL || w->stringID == STR_PREVIOUS || w->stringID == STR_YES || w->stringID == STR_NO) {
		GUI_DrawText_Wrapper(GUI_String_Get_ByIndex(w->stringID), positionX + (width / 2), positionY + 2, colour, 0, 0x122);
	} else {
		GUI_DrawText_Wrapper(GUI_String_Get_ByIndex(w->stringID), positionX + 3, positionY + 2, colour, 0, 0x22);
	}

	if (oldScreenID == SCREEN_0) {
		GUI_Mouse_Hide_InRegion(positionX, positionY, positionX + width, positionY + height);
		GUI_Screen_Copy(positionX >> 3, positionY, positionX >> 3, positionY, width >> 3, height, SCREEN_1, SCREEN_0);
		GUI_Mouse_Show_InRegion();
	}
Esempio n. 3
0
static void GUI_Widget_Undraw(Widget *w, uint8 colour)
{
	uint16 offsetX;
	uint16 offsetY;
	uint16 width;
	uint16 height;

	if (w == NULL) return;

	offsetX = w->offsetX + (g_widgetProperties[w->parentID].xBase << 3);
	offsetY = w->offsetY + g_widgetProperties[w->parentID].yBase;
	width = w->width;
	height = w->height;

	if (g_screenActiveID == SCREEN_0) {
		GUI_Mouse_Hide_InRegion(offsetX, offsetY, offsetX + width, offsetY + height);
	}

	GUI_DrawFilledRectangle(offsetX, offsetY, offsetX + width, offsetY + height, colour);

	if (g_screenActiveID == SCREEN_0) {
		GUI_Mouse_Show_InRegion();
	}
}
Esempio n. 4
0
/**
 * Draw sprites and handle mouse in a mentat screen.
 * @param speakingMode If \c 1, the mentat is speaking.
 */
void GUI_Mentat_Animation(uint16 speakingMode)
{
    static uint32 movingEyesTimer = 0;      /* Timer when to change the eyes sprite. */
    static uint16 movingEyesSprite = 0;     /* Index in _mentatSprites of the displayed moving eyes. */
    static uint16 movingEyesNextSprite = 0; /* If not 0, it decides the movingEyesNextSprite */

    static uint32 movingMouthTimer = 0;
    static uint16 movingMouthSprite = 0;

    static uint32 movingOtherTimer = 0;
    static int16 otherSprite = 0;

    bool partNeedsRedraw;
    uint16 i;

    if (movingOtherTimer < g_timerGUI && !g_disableOtherMovement) {
        if (movingOtherTimer != 0) {
            uint8 *sprite;

            if (s_mentatSprites[2][1 + abs(otherSprite)] == NULL) {
                otherSprite = 1 - otherSprite;
            } else {
                otherSprite++;
            }

            sprite = s_mentatSprites[2][abs(otherSprite)];

            GUI_Mouse_Hide_InRegion(s_otherLeft, s_otherTop, s_otherLeft + Sprite_GetWidth(sprite), s_otherTop + Sprite_GetHeight(sprite));
            GUI_DrawSprite(SCREEN_0, sprite, s_otherLeft, s_otherTop, 0, 0);
            GUI_Mouse_Show_InRegion();
        }

        switch (g_playerHouseID) {
        case HOUSE_HARKONNEN:
            movingOtherTimer = g_timerGUI + 300 * 60;
            break;
        case HOUSE_ATREIDES:
            movingOtherTimer = g_timerGUI + 60 * Tools_RandomLCG_Range(1,3);
            break;
        case HOUSE_ORDOS:
            if (otherSprite != 0) {
                movingOtherTimer = g_timerGUI + 6;
            } else {
                movingOtherTimer = g_timerGUI + 60 * Tools_RandomLCG_Range(10, 19);
            }
            break;
        default:
            break;
        }
    }

    if (speakingMode == 1) {
        if (movingMouthTimer < g_timerGUI) {
            uint8 *sprite;

            movingMouthSprite = Tools_RandomLCG_Range(0, 4);
            sprite = s_mentatSprites[1][movingMouthSprite];

            GUI_Mouse_Hide_InRegion(s_mouthLeft, s_mouthTop, s_mouthLeft + Sprite_GetWidth(sprite), s_mouthTop + Sprite_GetHeight(sprite));
            GUI_DrawSprite(SCREEN_0, sprite, s_mouthLeft, s_mouthTop, 0, 0);
            GUI_Mouse_Show_InRegion();

            switch (movingMouthSprite) {
            case 0:
                movingMouthTimer = g_timerGUI + Tools_RandomLCG_Range(7, 30);
                break;
            case 1:
            case 2:
            case 3:
                movingMouthTimer = g_timerGUI + Tools_RandomLCG_Range(6, 10);
                break;
            case 4:
                movingMouthTimer = g_timerGUI + Tools_RandomLCG_Range(5, 6);
                break;
            default:
                break;
            }
        }
    } else {
        partNeedsRedraw = false;

        if (Input_Test(0x41) == 0 && Input_Test(0x42) == 0) {
            if (movingMouthSprite != 0) {
                movingMouthSprite = 0;
                movingMouthTimer = 0;
                partNeedsRedraw = true;
            }
        } else if (Mouse_InsideRegion(s_mouthLeft, s_mouthTop, s_mouthRight, s_mouthBottom) != 0) {
            if (movingMouthTimer != 0xFFFFFFFF) {
                movingMouthTimer = 0xFFFFFFFF;
                movingMouthSprite = Tools_RandomLCG_Range(1, 4);
                partNeedsRedraw = true;
            }
        } else {
            if (movingMouthSprite != 0) {
                movingMouthSprite = 0;
                movingMouthTimer = 0;
                partNeedsRedraw = true;
            }
        }

        if (partNeedsRedraw) {
            uint8 *sprite;

            sprite = s_mentatSprites[1][movingMouthSprite];

            GUI_Mouse_Hide_InRegion(s_mouthLeft, s_mouthTop, s_mouthLeft + Sprite_GetWidth(sprite), s_mouthTop + Sprite_GetHeight(sprite));
            GUI_DrawSprite(SCREEN_0, sprite, s_mouthLeft, s_mouthTop, 0, 0);
            GUI_Mouse_Show_InRegion();
        }
    }

    partNeedsRedraw = false;

    if (Input_Test(0x41) != 0 || Input_Test(0x42) != 0) {
        if (Mouse_InsideRegion(s_eyesLeft, s_eyesTop, s_eyesRight, s_eyesBottom) != 0) {
            if (movingEyesSprite != 0x4) {
                partNeedsRedraw = true;
                movingEyesSprite = (movingEyesSprite == 3) ? 4 : 3;
                movingEyesNextSprite = 0;
                movingEyesTimer = 0;
            }

            if (partNeedsRedraw) {
                uint8 *sprite;

                sprite = s_mentatSprites[0][movingEyesSprite];

                GUI_Mouse_Hide_InRegion(s_eyesLeft, s_eyesTop, s_eyesLeft + Sprite_GetWidth(sprite), s_eyesTop + Sprite_GetHeight(sprite));
                GUI_DrawSprite(SCREEN_0, sprite, s_eyesLeft, s_eyesTop, 0, 0);
                GUI_Mouse_Show_InRegion();
            }

            return;
        }
    }

    if (Mouse_InsideRegion((int16)s_eyesLeft - 16, (int16)s_eyesTop - 8, s_eyesRight + 16, s_eyesBottom + 24) != 0) {
        if (Mouse_InsideRegion((int16)s_eyesLeft - 8, s_eyesBottom, s_eyesRight + 8, SCREEN_HEIGHT - 1) != 0) {
            i = 3;
        } else {
            if (Mouse_InsideRegion(s_eyesRight, (int16)s_eyesTop - 8, s_eyesRight + 16, s_eyesBottom + 8) != 0) {
                i = 2;
            } else {
                i = (Mouse_InsideRegion((int16)s_eyesLeft - 16, (int16)s_eyesTop - 8, s_eyesLeft, s_eyesBottom + 8) == 0) ? 0 : 1;
            }
        }

        if (i != movingEyesSprite) {
            partNeedsRedraw = true;
            movingEyesSprite = i;
            movingEyesNextSprite = 0;
            movingEyesTimer = g_timerGUI;
        }
    } else {
        if (movingEyesTimer >= g_timerGUI) return;

        partNeedsRedraw = true;
        if (movingEyesNextSprite != 0) {
            movingEyesSprite = movingEyesNextSprite;
            movingEyesNextSprite = 0;

            if (movingEyesSprite != 4) {
                movingEyesTimer = g_timerGUI + Tools_RandomLCG_Range(20, 180);
            } else {
                movingEyesTimer = g_timerGUI + Tools_RandomLCG_Range(12, 30);
            }
        } else {
            i = 0;
            switch (speakingMode) {
            case 0:
                i = Tools_RandomLCG_Range(0, 7);
                if (i > 5) {
                    i = 1;
                } else {
                    if (i == 5) {
                        i = 4;
                    }
                }
                break;

            case 1:
                if (movingEyesSprite != ((!g_interrogation) ? 0 : 3)) {
                    i = 0;
                } else {
                    i = Tools_RandomLCG_Range(0, 17);
                    if (i > 9) {
                        i = 0;
                    } else {
                        if (i >= 5) {
                            i = 4;
                        }
                    }
                }
                break;

            default:
                i = Tools_RandomLCG_Range(0, 15);
                if (i > 10) {
                    i = 2;
                } else {
                    if (i >= 5) {
                        i = 4;
                    }
                }
                break;
            }

            if ((i == 2 && movingEyesSprite == 1) || (i == 1 && movingEyesSprite == 2)) {
                movingEyesNextSprite = i;
                movingEyesSprite = 0;
                movingEyesTimer = g_timerGUI + Tools_RandomLCG_Range(1, 5);
            } else {
                if (i != movingEyesSprite && (i == 4 || movingEyesSprite == 4)) {
                    movingEyesNextSprite = i;
                    movingEyesSprite = 3;
                    movingEyesTimer = g_timerGUI;
                } else {
                    movingEyesSprite = i;
                    if (i != 4) {
                        movingEyesTimer = g_timerGUI + Tools_RandomLCG_Range(15, 180);
                    } else {
                        movingEyesTimer = g_timerGUI + Tools_RandomLCG_Range(6, 60);
                    }
                }
            }

            if (g_interrogation && movingEyesSprite == 0) movingEyesSprite = 3;
        }
    }

    if (partNeedsRedraw) {
        uint8 *sprite;

        sprite = s_mentatSprites[0][movingEyesSprite];

        GUI_Mouse_Hide_InRegion(s_eyesLeft, s_eyesTop, s_eyesLeft + Sprite_GetWidth(sprite), s_eyesTop + Sprite_GetHeight(sprite));
        GUI_DrawSprite(SCREEN_0, sprite, s_eyesLeft, s_eyesTop, 0, 0);
        GUI_Mouse_Show_InRegion();
    }
}
Esempio n. 5
0
uint16 GUI_Mentat_Loop(const char *wsaFilename, char *pictureDetails, char *text, bool arg12, Widget *w)
{
    Screen oldScreenID;
    uint16 old07AE;
    void *wsa;
    uint16 descLines;
    bool dirty;
    bool done;
    bool textDone;
    uint16 frame;
    uint32 descTick;
    uint16 mentatSpeakingMode;
    uint16 result;
    uint32 textTick;
    uint32 textDelay;
    uint16 lines;
    uint16 textLines;
    uint16 step;

    dirty = false;
    textTick = 0;
    textDelay = 0;

    old07AE = Widget_SetCurrentWidget(8);
    oldScreenID = GFX_Screen_SetActive(SCREEN_2);

    wsa = NULL;

    if (wsaFilename != NULL) {
        wsa = WSA_LoadFile(wsaFilename, GFX_Screen_Get_ByIndex(SCREEN_1), GFX_Screen_GetSize_ByIndex(SCREEN_1), false);
    }

    step = 0;
    if (wsa == NULL) {
        Widget_PaintCurrentWidget();
        step = 1;
    }

    GUI_DrawText_Wrapper(NULL, 0, 0, 0, 0, 0x31);

    descLines = GUI_SplitText(pictureDetails, (g_curWidgetWidth << 3) + 10, '\0');

    GUI_DrawText_Wrapper(NULL, 0, 0, 0, 0, 0x32);

    textLines = GUI_Mentat_SplitText(text, 304);

    mentatSpeakingMode = 2;
    lines = 0;
    frame = 0;
    g_timerTimeout = 0;
    descTick = g_timerGUI + 30;

    Input_History_Clear();

    textDone = false;
    result = 0;
    for (done = false; !done; sleepIdle()) {
        uint16 key;

        GFX_Screen_SetActive(SCREEN_0);

        key = GUI_Widget_HandleEvents(w);

        GUI_PaletteAnimate();

        if (key != 0) {
            if ((key & 0x800) == 0) {
                if (w != NULL) {
                    if ((key & 0x8000) != 0 && result == 0) result = key;
                } else {
                    if (textDone) result = key;
                }
            } else {
                key = 0;
            }
        }

        switch (step) {
        case 0:
            if (key == 0) break;
            step = 1;
        /* FALL-THROUGH */

        case 1:
            if (key != 0) {
                if (result != 0) {
                    step = 5;
                    break;
                }
                lines = descLines;
                dirty = true;
            } else {
                if (g_timerGUI > descTick) {
                    descTick = g_timerGUI + 15;
                    lines++;
                    dirty = true;
                }
            }

            if (lines < descLines && lines <= 12) break;

            step = (text != NULL) ? 2 : 4;
            lines = descLines;
            break;

        case 2:
            GUI_Mouse_Hide_InRegion(0, 0, SCREEN_WIDTH, 40);
            GUI_Screen_Copy(0, 0, 0, 160, SCREEN_WIDTH / 8, 40, SCREEN_0, SCREEN_2);
            GUI_Mouse_Show_InRegion();

            step = 3;
            key = 1;
        /* FALL-THROUGH */

        case 3:
            if (mentatSpeakingMode == 2 && textTick < g_timerGUI) key = 1;

            if ((key != 0 && textDone) || result != 0) {
                GUI_Mouse_Hide_InRegion(0, 0, SCREEN_WIDTH, 40);
                GUI_Screen_Copy(0, 160, 0, 0, SCREEN_WIDTH / 8, 40, SCREEN_2, SCREEN_0);
                GUI_Mouse_Show_InRegion();

                step = 4;
                mentatSpeakingMode = 0;
                break;
            }

            if (key != 0) {
                GUI_Screen_Copy(0, 160, 0, 0, SCREEN_WIDTH / 8, 40, SCREEN_2, SCREEN_2);

                if (textLines-- != 0) {
                    GFX_Screen_SetActive(SCREEN_2);
                    GUI_DrawText_Wrapper(text, 4, 1, g_curWidgetFGColourBlink, 0, 0x32);
                    mentatSpeakingMode = 1;
                    textDelay = (uint32)strlen(text) * 4;
                    textTick = g_timerGUI + textDelay;

                    if (textLines != 0) {
                        while (*text++ != '\0') {}
                    } else {
                        textDone = true;
                    }

                    GFX_Screen_SetActive(SCREEN_0);
                }

                GUI_Mouse_Hide_InRegion(0, 0, SCREEN_WIDTH, 40);
                GUI_Screen_Copy(0, 0, 0, 0, SCREEN_WIDTH / 8, 40, SCREEN_2, SCREEN_0);
                GUI_Mouse_Show_InRegion();
                break;
            }

            if (mentatSpeakingMode == 0 || textTick > g_timerGUI) break;

            mentatSpeakingMode = 2;
            textTick += textDelay + textDelay / 2;
            break;

        case 4:
            if (result != 0 || w == NULL) step = 5;
            break;

        case 5:
            dirty = true;
            done = true;
            break;

        default:
            break;
        }

        GUI_Mentat_Animation(mentatSpeakingMode);

        if (wsa != NULL && g_timerTimeout == 0) {
            g_timerTimeout = 7;

            do {
                if (step == 0 && frame > 4) step = 1;

                if (!WSA_DisplayFrame(wsa, frame++, g_curWidgetXBase << 3, g_curWidgetYBase, SCREEN_2)) {
                    if (step == 0) step = 1;

                    if (arg12 != 0) {
                        frame = 0;
                    } else {
                        WSA_Unload(wsa);
                        wsa = NULL;
                    }
                }
            } while (frame == 0);
            dirty = true;
        }

        if (!dirty) continue;

        GUI_Mentat_DrawInfo(pictureDetails, (g_curWidgetXBase << 3) + 5, g_curWidgetYBase + 3, 8, 0, lines, 0x31);

        GUI_DrawSprite(SCREEN_2, g_sprites[397 + g_playerHouseID * 15], g_shoulderLeft, g_shoulderTop, 0, 0);
        GUI_Mouse_Hide_InWidget(g_curWidgetIndex);
        GUI_Screen_Copy(g_curWidgetXBase, g_curWidgetYBase, g_curWidgetXBase, g_curWidgetYBase, g_curWidgetWidth, g_curWidgetHeight, SCREEN_2, SCREEN_0);
        GUI_Mouse_Show_InWidget();
        dirty = false;
    }

    if (wsa != NULL) WSA_Unload(wsa);

    GFX_Screen_SetActive(SCREEN_2);
    GUI_DrawSprite(SCREEN_2, g_sprites[397 + g_playerHouseID * 15], g_shoulderLeft, g_shoulderTop, 0, 0);
    GUI_Mouse_Hide_InWidget(g_curWidgetIndex);
    GUI_Screen_Copy(g_curWidgetXBase, g_curWidgetYBase, g_curWidgetXBase, g_curWidgetYBase, g_curWidgetWidth, g_curWidgetHeight, SCREEN_2, SCREEN_0);
    GUI_Mouse_Show_InWidget();
    Widget_SetCurrentWidget(old07AE);
    GFX_Screen_SetActive(oldScreenID);

    Input_History_Clear();

    return result;
}
Esempio n. 6
0
void async_GUI_Mentat_Loop() {
	uint16 key;

	GFX_Screen_SetActive(0);

	key = GUI_Widget_HandleEvents(asyncMentatLoop.w);

	GUI_PaletteAnimate();

	if (key != 0) {
		if ((key & 0x800) == 0) {
			if (asyncMentatLoop.w != NULL) {
				if ((key & 0x8000) != 0 && asyncMentatLoop.result == 0) asyncMentatLoop.result = key;
			} else {
				if (asyncMentatLoop.textDone) asyncMentatLoop.result = key;
			}
		} else {
			key = 0;
		}
	}

	switch (asyncMentatLoop.step) {
		case 0:
			if (key == 0) break;
			asyncMentatLoop.step = 1;
			/* FALL-THROUGH */

		case 1:
			if (key != 0) {
				if (asyncMentatLoop.result != 0) {
					asyncMentatLoop.step = 5;
					break;
				}
				asyncMentatLoop.lines = asyncMentatLoop.descLines;
				asyncMentatLoop.dirty = true;
			} else {
				if (g_timerGUI > asyncMentatLoop.descTick) {
					asyncMentatLoop.descTick = g_timerGUI + 15;
					asyncMentatLoop.lines++;
					asyncMentatLoop.dirty = true;
				}
			}

			if (asyncMentatLoop.lines < asyncMentatLoop.descLines && asyncMentatLoop.lines <= 12) break;

			asyncMentatLoop.step = (asyncMentatLoop.text != NULL) ? 2 : 4;
			asyncMentatLoop.lines = asyncMentatLoop.descLines;
			break;

		case 2:
			GUI_Mouse_Hide_InRegion(0, 0, SCREEN_WIDTH, 40);
			GUI_Screen_Copy(0, 0, 0, 160, SCREEN_WIDTH / 8, 40, 0, 4);
			GUI_Mouse_Show_InRegion();

			asyncMentatLoop.step = 3;
			key = 1;
			/* FALL-THROUGH */

		case 3:
			if (asyncMentatLoop.mentatSpeakingMode == 2 && asyncMentatLoop.textTick < g_timerGUI) key = 1;

			if ((key != 0 && asyncMentatLoop.textDone) || asyncMentatLoop.result != 0) {
				GUI_Mouse_Hide_InRegion(0, 0, SCREEN_WIDTH, 40);
				GUI_Screen_Copy(0, 160, 0, 0, SCREEN_WIDTH / 8, 40, 4, 0);
				GUI_Mouse_Show_InRegion();

				asyncMentatLoop.step = 4;
				asyncMentatLoop.mentatSpeakingMode = 0;
				break;
			}

			if (key != 0) {
				GUI_Screen_Copy(0, 160, 0, 0, SCREEN_WIDTH / 8, 40, 4, 4);

				if (asyncMentatLoop.textLines-- != 0) {
					GFX_Screen_SetActive(4);
					GUI_DrawText_Wrapper(asyncMentatLoop.text, 4, 1, g_curWidgetFGColourBlink, 0, 0x32);
					asyncMentatLoop.mentatSpeakingMode = 1;
					asyncMentatLoop.textDelay = strlen(asyncMentatLoop.text) * 4;
					asyncMentatLoop.textTick = g_timerGUI + asyncMentatLoop.textDelay;

					if (asyncMentatLoop.textLines != 0) {
						while (*asyncMentatLoop.text++ != '\0') {}
					} else {
						asyncMentatLoop.textDone = true;
					}

					GFX_Screen_SetActive(0);
				}

				GUI_Mouse_Hide_InRegion(0, 0, SCREEN_WIDTH, 40);
				GUI_Screen_Copy(0, 0, 0, 0, SCREEN_WIDTH / 8, 40, 4, 0);
				GUI_Mouse_Show_InRegion();
				break;
			}

			if (asyncMentatLoop.mentatSpeakingMode == 0 || asyncMentatLoop.textTick > g_timerGUI) break;

			asyncMentatLoop.mentatSpeakingMode = 2;
			asyncMentatLoop.textTick += asyncMentatLoop.textDelay + asyncMentatLoop.textDelay / 2;
			break;

		case 4:
			if (asyncMentatLoop.result != 0 || asyncMentatLoop.w == NULL) asyncMentatLoop.step = 5;
			break;

		case 5:
			asyncMentatLoop.dirty = true;
			asyncMentatLoop.done = true;
			break;

		default: break;
	}

	GUI_Mentat_Animation(asyncMentatLoop.mentatSpeakingMode);

	if (asyncMentatLoop.wsa != NULL && g_timerTimeout == 0) {
		g_timerTimeout = 7;

		do {
			if (asyncMentatLoop.step == 0 && asyncMentatLoop.frame > 4) asyncMentatLoop.step = 1;

			if (!WSA_DisplayFrame(asyncMentatLoop.wsa, asyncMentatLoop.frame++, g_curWidgetXBase << 3, g_curWidgetYBase, 4)) {
				if (asyncMentatLoop.step == 0) asyncMentatLoop.step = 1;

				if (asyncMentatLoop.arg12 != 0) {
					asyncMentatLoop.frame = 0;
				} else {
					WSA_Unload(asyncMentatLoop.wsa);
					asyncMentatLoop.wsa = NULL;
				}
			}
		} while (asyncMentatLoop.frame == 0);
		asyncMentatLoop.dirty = true;
	}

	if (!asyncMentatLoop.dirty) {
		sleepIdle();
		return;
	}

	GUI_Mentat_DrawInfo(asyncMentatLoop.pictureDetails, (g_curWidgetXBase << 3) + 5, g_curWidgetYBase + 3, 8, 0, asyncMentatLoop.lines, 0x31);

	GUI_DrawSprite(4, g_sprites[397 + g_playerHouseID * 15], g_shoulderLeft, g_shoulderTop, 0, 0);
	GUI_Mouse_Hide_InWidget(g_curWidgetIndex);
	GUI_Screen_Copy(g_curWidgetXBase, g_curWidgetYBase, g_curWidgetXBase, g_curWidgetYBase, g_curWidgetWidth, g_curWidgetHeight, 4, 0);
	GUI_Mouse_Show_InWidget();
	asyncMentatLoop.dirty = false;

	sleepIdle();
}