Optimizing
This commit is contained in:
		| 
		 Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB  | 
| 
		 Before Width: | Height: | Size: 119 B After Width: | Height: | Size: 119 B  | 
@@ -7,21 +7,22 @@
 | 
			
		||||
 | 
			
		||||
#include "fade.h"
 | 
			
		||||
 | 
			
		||||
void conversationFadeToBlack() {
 | 
			
		||||
inline void conversationFadeToBlack() {
 | 
			
		||||
  TIME_FUTURE = TIME_CURRENT;
 | 
			
		||||
  TIME_FUTURE_TYPE = TIME_FUTURE_TYPE_FADE_TO_BLACK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void conversationFadeFromBlack() {
 | 
			
		||||
inline void conversationFadeFromBlack() {
 | 
			
		||||
  TIME_FUTURE = TIME_CURRENT;
 | 
			
		||||
  TIME_FUTURE_TYPE = TIME_FUTURE_TYPE_FADE_FROM_BLACK;
 | 
			
		||||
}
 | 
			
		||||
void conversationFadeToWhite() {
 | 
			
		||||
 | 
			
		||||
inline void conversationFadeToWhite() {
 | 
			
		||||
  TIME_FUTURE = TIME_CURRENT;
 | 
			
		||||
  TIME_FUTURE_TYPE = TIME_FUTURE_TYPE_FADE_TO_WHITE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void conversationFadeFromWhite() {
 | 
			
		||||
inline void conversationFadeFromWhite() {
 | 
			
		||||
  TIME_FUTURE = TIME_CURRENT;
 | 
			
		||||
  TIME_FUTURE_TYPE = TIME_FUTURE_TYPE_FADE_FROM_WHITE;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -14,8 +14,8 @@
 | 
			
		||||
// This is how many frames it takes to change each shade.
 | 
			
		||||
#define FADE_STEP 20
 | 
			
		||||
 | 
			
		||||
void conversationFadeToBlack();
 | 
			
		||||
void conversationFadeFromBlack();
 | 
			
		||||
void conversationFadeToWhite();
 | 
			
		||||
void conversationFadeFromWhite();
 | 
			
		||||
inline void conversationFadeToBlack();
 | 
			
		||||
inline void conversationFadeFromBlack();
 | 
			
		||||
inline void conversationFadeToWhite();
 | 
			
		||||
inline void conversationFadeFromWhite();
 | 
			
		||||
void conversationFadeUpdate();
 | 
			
		||||
@@ -7,12 +7,12 @@
 | 
			
		||||
 | 
			
		||||
#include "pause.h"
 | 
			
		||||
 | 
			
		||||
void conversationPause(uint16_t duration) {
 | 
			
		||||
inline void conversationPause(uint16_t duration) {
 | 
			
		||||
  TIME_FUTURE = TIME_CURRENT + (duration * TIME_PER_SECOND);
 | 
			
		||||
  TIME_FUTURE_TYPE = TIME_FUTURE_TYPE_PAUSE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void conversationPauseUpdate() {
 | 
			
		||||
inline void conversationPauseUpdate() {
 | 
			
		||||
  if(TIME_FUTURE_TYPE != TIME_FUTURE_TYPE_PAUSE || TIME_CURRENT != TIME_FUTURE) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -10,5 +10,5 @@
 | 
			
		||||
#include "../time.h"
 | 
			
		||||
#include "queue.h"
 | 
			
		||||
 | 
			
		||||
void conversationPause(uint16_t duration);
 | 
			
		||||
void conversationPauseUpdate();
 | 
			
		||||
inline void conversationPause(uint16_t duration);
 | 
			
		||||
inline void conversationPauseUpdate();
 | 
			
		||||
@@ -33,14 +33,16 @@ void conversationQueueDealCards() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void conversationQueueBeginBetting() {
 | 
			
		||||
  uint8_t i;
 | 
			
		||||
  // Begin the betting process. First we need to decide if the player or the
 | 
			
		||||
  // AI is betting, then based on that we decide what to do next.
 | 
			
		||||
  QUEUE_ITEM = QUEUE_DEBUG;
 | 
			
		||||
  conversationTextboxString(DEBUG_WINNER_DECIDED);
 | 
			
		||||
  return;
 | 
			
		||||
 | 
			
		||||
  // TODO: Next better
 | 
			
		||||
  // TODO: Actually bet.
 | 
			
		||||
  if(POKER_PLAYER_BETTER == POKER_HUMAN_INDEX) {
 | 
			
		||||
    // This is the human player.
 | 
			
		||||
    BGB_MESSAGE("Players turn to bet");
 | 
			
		||||
    BGB_MESSAGE("Player betting.");
 | 
			
		||||
    POKER_PLAYERS[
 | 
			
		||||
      POKER_PLAYER_BETTER
 | 
			
		||||
    ].state |= POKER_PLAYER_STATE_HAS_BET_THIS_ROUND;
 | 
			
		||||
@@ -51,33 +53,73 @@ void conversationQueueBeginBetting() {
 | 
			
		||||
      POKER_PLAYER_BETTER
 | 
			
		||||
    ].state |= POKER_PLAYER_STATE_HAS_BET_THIS_ROUND;
 | 
			
		||||
  }
 | 
			
		||||
  // TODO: Decide if we need to continue betting or decide a winner
 | 
			
		||||
 | 
			
		||||
  QUEUE_ITEM = QUEUE_NEXT_BETTER;
 | 
			
		||||
  conversationQueueNext();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void conversationQueueNextBetter() {
 | 
			
		||||
  uint8_t i, j, k;
 | 
			
		||||
 | 
			
		||||
  // Now we decide the next better.
 | 
			
		||||
  for(i = 0; i < POKER_PLAYER_COUNT_MAX; i++) {
 | 
			
		||||
    // Can the player even do anything?
 | 
			
		||||
    //In theory I don't think the current better can ever be selected again.
 | 
			
		||||
    if(i == POKER_PLAYER_BETTER) continue;
 | 
			
		||||
 | 
			
		||||
    // Next better is the better to the right of the current better.
 | 
			
		||||
    j = (POKER_PLAYER_BETTER + i) % POKER_PLAYER_COUNT_MAX;
 | 
			
		||||
    
 | 
			
		||||
    // Can this player even participate?
 | 
			
		||||
    if(
 | 
			
		||||
      (
 | 
			
		||||
        POKER_PLAYERS[POKER_PLAYER_BETTER].state &
 | 
			
		||||
        (POKER_PLAYER_STATE_FOLDED|POKER_PLAYER_STATE_OUT)
 | 
			
		||||
      ) != 0 ||
 | 
			
		||||
      POKER_PLAYERS[POKER_PLAYER_BETTER].chips == 0
 | 
			
		||||
        POKER_PLAYERS[j].state & (
 | 
			
		||||
          POKER_PLAYER_STATE_FOLDED|POKER_PLAYER_STATE_OUT
 | 
			
		||||
        )
 | 
			
		||||
      ) != 0 || POKER_PLAYERS[j].chips == 0
 | 
			
		||||
    ) continue;
 | 
			
		||||
 | 
			
		||||
    // Has the player bet? If so are they in the current pot?
 | 
			
		||||
    if((
 | 
			
		||||
      POKER_PLAYERS[POKER_PLAYER_BETTER].state &
 | 
			
		||||
      POKER_PLAYERS[j].state &
 | 
			
		||||
      POKER_PLAYER_STATE_HAS_BET_THIS_ROUND
 | 
			
		||||
    ) != 0) {
 | 
			
		||||
      // TODO: confirm uh if they are up to the currently raised pot point or 
 | 
			
		||||
      // not.
 | 
			
		||||
      continue;
 | 
			
		||||
      // Check each pot, if the pot is inactive or the player is CALLED/CHECKED
 | 
			
		||||
      for(k = 0; k < POKER_POT_COUNT_MAX; k++) {
 | 
			
		||||
        // Is this pot active?
 | 
			
		||||
        if(POKER_POTS[k].chips == 0) {
 | 
			
		||||
          k = POKER_POT_COUNT_MAX;
 | 
			
		||||
          break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Is the player called into this pot all the way?
 | 
			
		||||
        if(POKER_POTS[k].players[j] == POKER_POTS[k].call) continue;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      // Then skip to next player.
 | 
			
		||||
      if(k == POKER_POT_COUNT_MAX) continue;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // They haven't bet yet, make them the "next better"
 | 
			
		||||
    POKER_PLAYER_BETTER = j;
 | 
			
		||||
    conversationQueueNext();
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // If we reach this point then we either need to begin the betting round, or
 | 
			
		||||
  // we are going to move to the winning decider. TODO: Figure out if winning
 | 
			
		||||
  // phase or turn phase.
 | 
			
		||||
  // we are going to move to the winning decider.
 | 
			
		||||
  if(
 | 
			
		||||
    i == POKER_PLAYER_COUNT_MAX ||
 | 
			
		||||
    POKER_COMMUNITY_SIZE_MAX == POKER_COMMUNITY_SIZE
 | 
			
		||||
  ) {
 | 
			
		||||
    QUEUE_ITEM = QUEUE_WINNER_DECIDE;
 | 
			
		||||
    conversationQueueNext();
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Reset the players betting state so that they may bet next round.
 | 
			
		||||
  for(i = 0; i < POKER_PLAYER_COUNT_MAX; i++) {
 | 
			
		||||
    POKER_PLAYERS[i].state &= ~POKER_PLAYER_STATE_HAS_BET_THIS_ROUND;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  QUEUE_ITEM = QUEUE_FLOP;
 | 
			
		||||
  conversationQueueNext();
 | 
			
		||||
@@ -158,14 +200,14 @@ queuecallback_t *QUEUE_CALLBACKS[] = {
 | 
			
		||||
  NULL,
 | 
			
		||||
 | 
			
		||||
  // 25
 | 
			
		||||
  &conversationQueueFlopTurnRiver,
 | 
			
		||||
  &conversationQueueNextBetter,
 | 
			
		||||
  NULL,
 | 
			
		||||
  NULL,
 | 
			
		||||
  NULL,
 | 
			
		||||
  NULL,
 | 
			
		||||
 | 
			
		||||
  // 30
 | 
			
		||||
  NULL,
 | 
			
		||||
  &conversationQueueFlopTurnRiver,
 | 
			
		||||
  NULL,
 | 
			
		||||
  NULL,
 | 
			
		||||
  NULL,
 | 
			
		||||
@@ -186,6 +228,12 @@ queuecallback_t *QUEUE_CALLBACKS[] = {
 | 
			
		||||
  // NULL,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void conversationQueueInit() {
 | 
			
		||||
inline void conversationQueueInit() {
 | 
			
		||||
  QUEUE_ITEM = QUEUE_BEGIN;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void  conversationQueueNext() {
 | 
			
		||||
  if(QUEUE_ITEM > QUEUE_WINNER_DECIDE) return;
 | 
			
		||||
  if(QUEUE_CALLBACKS[QUEUE_ITEM] == NULL) return;
 | 
			
		||||
  QUEUE_CALLBACKS[QUEUE_ITEM]();
 | 
			
		||||
}
 | 
			
		||||
@@ -19,9 +19,9 @@ extern queuecallback_t *QUEUE_CALLBACKS[];
 | 
			
		||||
#define QUEUE_TAKE_BLINDS 10
 | 
			
		||||
#define QUEUE_DEAL_CARDS 15
 | 
			
		||||
#define QUEUE_BEGIN_BETTING 20
 | 
			
		||||
#define QUEUE_FLOP 25
 | 
			
		||||
#define QUEUE_NEXT_BETTER 25
 | 
			
		||||
#define QUEUE_FLOP 30
 | 
			
		||||
#define QUEUE_WINNER_DECIDE 40
 | 
			
		||||
 | 
			
		||||
#define conversationQueueNext() QUEUE_CALLBACKS[QUEUE_ITEM]()
 | 
			
		||||
 | 
			
		||||
void conversationQueueInit();
 | 
			
		||||
inline void conversationQueueInit();
 | 
			
		||||
inline void conversationQueueNext();
 | 
			
		||||
@@ -11,10 +11,11 @@ char *TEXTBOX_TEXT;
 | 
			
		||||
uint8_t TEXTBOX_TEXT_LENGTH;
 | 
			
		||||
uint8_t TEXTBOX_STATE;
 | 
			
		||||
uint8_t TEXTBOX_SCROLL;
 | 
			
		||||
uint8_t TEXTBOX_TILES[TEXTBOX_TILES_MAX];
 | 
			
		||||
uint8_t TEXTBOX_CHAR_POSITION;
 | 
			
		||||
 | 
			
		||||
void conversationTextboxInit() {
 | 
			
		||||
inline void conversationTextboxInit() {
 | 
			
		||||
  uint8_t i;
 | 
			
		||||
  uint8_t TEXTBOX_TILES[TEXTBOX_TILES_MAX];
 | 
			
		||||
 | 
			
		||||
  // Reset textbox state
 | 
			
		||||
  TEXTBOX_TEXT = NULL;
 | 
			
		||||
@@ -42,36 +43,44 @@ void conversationTextboxInit() {
 | 
			
		||||
    TEXTBOX_TILES[TEXTBOX_WIDTH_IN_TILES * i] = BORDER_TILE_CENTER_LEFT;
 | 
			
		||||
    TEXTBOX_TILES[TEXTBOX_WIDTH_IN_TILES * (i+1) - 1] = BORDER_TILE_CENTER_RIGHT;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Setup tiles.
 | 
			
		||||
  set_win_tiles(
 | 
			
		||||
    0, 0,
 | 
			
		||||
    TEXTBOX_WIDTH_IN_TILES, TEXTBOX_HEIGHT_IN_TILES,
 | 
			
		||||
    TEXTBOX_TILES
 | 
			
		||||
  );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void conversationTextboxSetText(char *text, uint8_t length) {
 | 
			
		||||
  uint8_t i, j;
 | 
			
		||||
  uint8_t TEXTBOX_TILES[TEXTBOX_CHAR_ROWS * TEXTBOX_CHARS_PER_ROW];
 | 
			
		||||
 | 
			
		||||
  // Reset textbox state
 | 
			
		||||
  TEXTBOX_TEXT = text;
 | 
			
		||||
  TEXTBOX_TEXT_LENGTH = length;
 | 
			
		||||
  TEXTBOX_STATE = TEXTBOX_STATE_VISIBLE;
 | 
			
		||||
  TEXTBOX_SCROLL = 0;
 | 
			
		||||
  TEXTBOX_CHAR_POSITION = 0;
 | 
			
		||||
  
 | 
			
		||||
  // Fill blank characters
 | 
			
		||||
  for(j = 0; j < TEXTBOX_CHAR_ROWS; j++) {
 | 
			
		||||
    for(i = 0; i < TEXTBOX_CHARS_PER_ROW ; i++) {
 | 
			
		||||
      TEXTBOX_TILES[(i+1) + ((j + 1) * TEXTBOX_WIDTH_IN_TILES)] = (
 | 
			
		||||
        TEXTBOX_TILE_BLANK
 | 
			
		||||
      );
 | 
			
		||||
      TEXTBOX_TILES[i + (j * TEXTBOX_CHARS_PER_ROW)] = TEXTBOX_TILE_BLANK;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  set_win_tiles(
 | 
			
		||||
    0, 0,
 | 
			
		||||
    TEXTBOX_WIDTH_IN_TILES, TEXTBOX_HEIGHT_IN_TILES,
 | 
			
		||||
    1, 1,
 | 
			
		||||
    TEXTBOX_WIDTH_IN_TILES - 0x02, TEXTBOX_HEIGHT_IN_TILES - 0x02,
 | 
			
		||||
    TEXTBOX_TILES
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  // Show the window layer.
 | 
			
		||||
  SHOW_WIN;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void conversationTextboxUpdate() {
 | 
			
		||||
  uint8_t i, j;
 | 
			
		||||
inline void conversationTextboxUpdate() {
 | 
			
		||||
  uint8_t i;
 | 
			
		||||
 | 
			
		||||
  // Is the textbox visible?
 | 
			
		||||
  if(!(TEXTBOX_STATE & TEXTBOX_STATE_VISIBLE)) return;
 | 
			
		||||
@@ -88,35 +97,25 @@ void conversationTextboxUpdate() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Move to the next character.
 | 
			
		||||
  TEXTBOX_SCROLL++;
 | 
			
		||||
  j = TEXTBOX_WIDTH_IN_TILES + 1;
 | 
			
		||||
  for(i = 0; i < TEXTBOX_SCROLL; i++) {
 | 
			
		||||
  if(TEXTBOX_TEXT[TEXTBOX_SCROLL] == ' ') {
 | 
			
		||||
    // Whitespace, do nothing.
 | 
			
		||||
    if(TEXTBOX_TEXT[i] == ' ') {
 | 
			
		||||
      j++;
 | 
			
		||||
      continue;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    TEXTBOX_CHAR_POSITION++;
 | 
			
		||||
  } else if(TEXTBOX_TEXT[TEXTBOX_SCROLL] == '\n') {
 | 
			
		||||
    // Newline character, move the next tile to the next row.
 | 
			
		||||
    if(TEXTBOX_TEXT[i] == '\n') {
 | 
			
		||||
      j = (
 | 
			
		||||
        (j / TEXTBOX_WIDTH_IN_TILES)*TEXTBOX_WIDTH_IN_TILES
 | 
			
		||||
      ) + TEXTBOX_WIDTH_IN_TILES + 1;
 | 
			
		||||
      continue;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Reveal the next character
 | 
			
		||||
    TEXTBOX_TILES[j] = TEXTBOX_TEXT[i];
 | 
			
		||||
    j++;
 | 
			
		||||
    TEXTBOX_CHAR_POSITION = (
 | 
			
		||||
      (TEXTBOX_CHAR_POSITION / TEXTBOX_CHARS_PER_ROW) + 1
 | 
			
		||||
    ) * TEXTBOX_CHARS_PER_ROW;
 | 
			
		||||
  } else {
 | 
			
		||||
    // Reveal the next character. TODO: I'll optimize this.
 | 
			
		||||
    set_win_tiles(
 | 
			
		||||
      1 + (TEXTBOX_CHAR_POSITION % TEXTBOX_CHARS_PER_ROW),
 | 
			
		||||
      1 + (TEXTBOX_CHAR_POSITION / TEXTBOX_CHARS_PER_ROW),
 | 
			
		||||
      1, 1,
 | 
			
		||||
      TEXTBOX_TEXT + TEXTBOX_SCROLL
 | 
			
		||||
    );
 | 
			
		||||
    TEXTBOX_CHAR_POSITION++;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Update the window tilemap
 | 
			
		||||
  set_win_tiles(
 | 
			
		||||
    0, 0,
 | 
			
		||||
    TEXTBOX_WIDTH_IN_TILES,
 | 
			
		||||
    TEXTBOX_HEIGHT_IN_TILES,
 | 
			
		||||
    TEXTBOX_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.
 | 
			
		||||
 
 | 
			
		||||
@@ -45,8 +45,8 @@ extern char *TEXTBOX_TEXT;
 | 
			
		||||
extern uint8_t TEXTBOX_TEXT_LENGTH;
 | 
			
		||||
extern uint8_t TEXTBOX_STATE;
 | 
			
		||||
extern uint8_t TEXTBOX_SCROLL;
 | 
			
		||||
extern uint8_t TEXTBOX_TILES[];
 | 
			
		||||
extern uint8_t TEXTBOX_CHAR_POSITION;
 | 
			
		||||
 | 
			
		||||
void conversationTextboxInit();
 | 
			
		||||
inline void conversationTextboxInit();
 | 
			
		||||
void conversationTextboxSetText(char *text, uint8_t length);
 | 
			
		||||
void conversationTextboxUpdate();
 | 
			
		||||
inline void conversationTextboxUpdate();
 | 
			
		||||
@@ -14,6 +14,6 @@ const uint8_t COMMON_TILES[] = {
 | 
			
		||||
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void commonTilesInit() {
 | 
			
		||||
inline void commonTilesInit() {
 | 
			
		||||
  set_bkg_data(0x00, COMMON_TILE_COUNT, COMMON_TILES);
 | 
			
		||||
}
 | 
			
		||||
@@ -34,4 +34,4 @@
 | 
			
		||||
 | 
			
		||||
extern const uint8_t COMMON_TILES[];
 | 
			
		||||
 | 
			
		||||
void commonTilesInit();
 | 
			
		||||
inline void commonTilesInit();
 | 
			
		||||
@@ -8,8 +8,8 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
#include "FONT.h"
 | 
			
		||||
#include "BORDER.h"
 | 
			
		||||
#include "SM.h"
 | 
			
		||||
// #include "SM.h"
 | 
			
		||||
 | 
			
		||||
#define FONT_DATA_POSITION 0x04
 | 
			
		||||
#define BORDER_DATA_POSITION FONT_DATA_POSITION+FONT_IMAGE_TILES
 | 
			
		||||
#define SM_DATA_POSITION BORDER_DATA_POSITION+BORDER_IMAGE_TILES
 | 
			
		||||
// #define SM_DATA_POSITION BORDER_DATA_POSITION+BORDER_IMAGE_TILES
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,6 @@
 | 
			
		||||
#include <gb/gb.h>
 | 
			
		||||
#include <gb/bgb_emu.h>
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
// #include <stdio.h>
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
#include <rand.h>
 | 
			
		||||
@@ -6,7 +6,6 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "main.h"
 | 
			
		||||
#include "SM.h"
 | 
			
		||||
 | 
			
		||||
void main() {
 | 
			
		||||
  int16_t j;
 | 
			
		||||
@@ -37,19 +36,12 @@ void main() {
 | 
			
		||||
  SCX_REG = 0x00;
 | 
			
		||||
  SCY_REG = 0x00;
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
  set_bkg_data(SM_DATA_POSITION, SM_IMAGE_TILES, SM_IMAGE);
 | 
			
		||||
  uint8_t sm[SM_IMAGE_TILES];
 | 
			
		||||
  for(j = 0; j < SM_IMAGE_TILES; j++) sm[j] = j + SM_DATA_POSITION;
 | 
			
		||||
  set_bkg_tiles(0x00, 0x00, SM_IMAGE_COLUMNS, SM_IMAGE_ROWS, sm);
 | 
			
		||||
 | 
			
		||||
  // Now turn the screen on
 | 
			
		||||
  DISPLAY_ON;
 | 
			
		||||
  enable_interrupts();
 | 
			
		||||
  wait_vbl_done();
 | 
			
		||||
 | 
			
		||||
  // Alright begin the game logic here.
 | 
			
		||||
  BGB_MESSAGE("Begin.");
 | 
			
		||||
  conversationQueueNext();
 | 
			
		||||
 | 
			
		||||
  // Begin the loop
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,9 @@ void pokerNewRound() {
 | 
			
		||||
  for(i = 0; i < POKER_POT_COUNT_MAX; i++) {
 | 
			
		||||
    POKER_POTS[i].chips = 0;
 | 
			
		||||
    POKER_POTS[i].call = 0;
 | 
			
		||||
    POKER_POTS[i].playersCount = 0;
 | 
			
		||||
    for(j = 0; j < POKER_PLAYER_COUNT_MAX; j++) {
 | 
			
		||||
      POKER_POTS[i].players[j] = 0;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Fill deck
 | 
			
		||||
 
 | 
			
		||||
@@ -18,9 +18,8 @@ typedef struct {
 | 
			
		||||
  /** Current call value for this pot */
 | 
			
		||||
  uint16_t call;
 | 
			
		||||
 | 
			
		||||
  /** Players who are participating in the pot */
 | 
			
		||||
  uint8_t players[POKER_PLAYER_COUNT_MAX];
 | 
			
		||||
  uint8_t playersCount;
 | 
			
		||||
  /** Players who are participating in the pots current bet (in the pot) */
 | 
			
		||||
  uint16_t players[POKER_PLAYER_COUNT_MAX];
 | 
			
		||||
} pokerpot_t;
 | 
			
		||||
 | 
			
		||||
extern pokerpot_t POKER_POTS[];
 | 
			
		||||
 
 | 
			
		||||
@@ -11,12 +11,12 @@ uint16_t TIME_CURRENT;
 | 
			
		||||
uint16_t TIME_FUTURE;
 | 
			
		||||
uint8_t TIME_FUTURE_TYPE;
 | 
			
		||||
 | 
			
		||||
void timeInit() {
 | 
			
		||||
inline void timeInit() {
 | 
			
		||||
  TIME_CURRENT = 0;
 | 
			
		||||
  TIME_FUTURE = 0;
 | 
			
		||||
  TIME_FUTURE_TYPE = TIME_FUTURE_TYPE_NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void timeUpdate() {
 | 
			
		||||
inline void timeUpdate() {
 | 
			
		||||
  TIME_CURRENT++;
 | 
			
		||||
}
 | 
			
		||||
@@ -21,5 +21,5 @@ extern uint16_t TIME_CURRENT;
 | 
			
		||||
extern uint16_t TIME_FUTURE;
 | 
			
		||||
extern uint8_t TIME_FUTURE_TYPE;
 | 
			
		||||
 | 
			
		||||
void timeInit();
 | 
			
		||||
void timeUpdate();
 | 
			
		||||
inline void timeInit();
 | 
			
		||||
inline void timeUpdate();
 | 
			
		||||
		Reference in New Issue
	
	Block a user