Comitting progress

This commit is contained in:
2022-02-20 10:41:00 -08:00
parent 593dc25d47
commit 59571f6089

View File

@@ -21,7 +21,7 @@ inline void conversationTextboxInit() {
TEXTBOX_STATE = 0;
// Setup window data
move_win(7, SCREENHEIGHT - (TEXTBOX_HEIGHT_IN_TILES * 8));
// move_win(7, SCREENHEIGHT - (TEXTBOX_HEIGHT_IN_TILES * 8));
set_win_data(FONT_DATA_POSITION, FONT_IMAGE_TILES, FONT_IMAGE);
set_win_data(BORDER_DATA_POSITION, BORDER_IMAGE_TILES, BORDER_IMAGE);
@@ -68,10 +68,11 @@ void conversationTextboxSetText(char *text) {
while((c = text[i]) != '\0') {
if(c == ' ') {
// Scan ahead and look at how many chars remain to the next space
k = i;
while((c2 = text[++k]) != '\0') {
k = i + 1;
while((c2 = text[k]) != '\0') {
if(c2 == '\n' || c2 == ' ') break;
if((k - rowStart) >= TEXTBOX_CHARS_PER_ROW) break;
k++;
}
// IF that number is less than the remaining chars on the current row,
@@ -105,7 +106,7 @@ void conversationTextboxSetText(char *text) {
}
}
set_win_tiles(
1, 1,
0x01, 0x01,
TEXTBOX_WIDTH_IN_TILES - 0x02, TEXTBOX_HEIGHT_IN_TILES - 0x02,
TEXTBOX_TILES
);
@@ -117,49 +118,26 @@ void conversationTextboxSetText(char *text) {
inline void conversationTextboxUpdate() {
uint8_t i;
char c;
uint8_t tiles[1];
// Is the textbox visible?
if(!(TEXTBOX_STATE & TEXTBOX_STATE_VISIBLE)) return;
// Has the textbox finished scrolling?
// if(TEXTBOX_STATE & TEXTBOX_STATE_SCROLLED) {
// // Is the player attempting to close the textbox?
// if(INPUT_STATE & J_A) {
// TEXTBOX_STATE &= ~TEXTBOX_STATE_VISIBLE;
// HIDE_WIN;
// conversationQueueNext();
// }
// return;
// }
if((TEXTBOX_STATE & TEXTBOX_STATE_VISIBLE) == 0) return;
// Move to the next character.
i = TEXTBOX_ROW_CURRENT * TEXTBOX_CHARS_PER_ROW;
c = TEXTBOX_TEXTS[i+TEXTBOX_SCROLL];
// while((c = TEXTBOX_TEXTS[i+TEXTBOX_SCROLL]) == ' ') {
// TEXTBOX_SCROLL++;
// if(TEXTBOX_SCROLL == TEXTBOX_CHARS_MAX) {
// c = '\0';
// break;
// }
// }
if(TEXTBOX_SCROLL == TEXTBOX_CHARS_MAX) {
// TEXTBOX_
} else if(c != '\0') {
} else {
tiles[0] = c - 33 + 4;
set_win_tiles(
1 + (TEXTBOX_SCROLL % TEXTBOX_CHARS_PER_ROW),
1 + (TEXTBOX_SCROLL / TEXTBOX_CHARS_PER_ROW),
1, 1,
0x04
tiles
);
TEXTBOX_SCROLL++;
}
// // Update state. TODO: I actually don't really need this state, it's just here
// // incase I want to check if the state has scrolled later on? Doubt it though.
// if(TEXTBOX_SCROLL == TEXTBOX_TEXT_LENGTH) {
// TEXTBOX_STATE |= TEXTBOX_STATE_SCROLLED;
// }
}