Skip to content

Commit

Permalink
Add Trophy Tussle 1 & 2
Browse files Browse the repository at this point in the history
also add configcreate for all-star
  • Loading branch information
Savestate2A03 committed Mar 29, 2020
1 parent cc83155 commit 6d324e7
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ $RECYCLE.BIN/

manip.cfg
manip.s
*.zip
*.zip
manip_bakcup.cfg
71 changes: 71 additions & 0 deletions configcreate.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<html>
<head>
<title>Config File Helper</title>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script>
var list = [
"Rainbow Cruise (vs <strong>Mario</strong>)",
"Kongo Jungle (vs <strong>Donkey Kong</strong>)",
"Great Bay (vs <strong>Link</strong>)",
"Brinstar (vs <strong>Samus</strong>)",
"Yoshi's Story (vs <strong>Yoshi</strong>)",
"Green Greens (vs <strong>Kirby</strong>)",
"Corneria (vs <strong>Fox</strong>)",
"Pokémon Stadium (vs <strong>Pikachu</strong>)",
"Mushroom Kingdom I (vs <strong>Luigi</strong>)",
"Mute City (vs <strong>Captain Falcon</strong>)",
"Onett (vs <strong>Ness</strong>)",
"Poké Floats (vs <strong>Jigglypuff</strong>)",
"Icicle Mountain (vs <strong>Ice Climbers</strong>)",
"Princess Peach's Castle (vs <strong>Peach</strong>)",
"Temple (vs <strong>Zelda</strong>)",
"Fountain of Dreams (Emblem Music) (vs <strong>Marth</strong>)",
"Battlefield (Poké Floats song) (vs <strong>Mewtwo</strong>)",
"Yoshi's Island (vs <strong>Bowser</strong>)",
"Mushroom Kingdom II (Dr Mario Music) (vs <strong>Dr Mario</strong>)",
"Jungle Japes (vs Young <strong>Link</strong>)",
"Venom (vs <strong>Falco</strong>)",
"Fourside (vs <strong>Pichu</strong>)",
"Final Destination (Emblem Music) (vs <strong>Roy</strong>)",
"Flat Zone (vs Team <strong>Game & Watch</strong>)",
"Brinstar Depths (vs <strong>Ganondorf</strong>)"
];
$( document ).ready(() => {
$.each(list, (index, character) => {
var checkbox = $("<input>").attr({
type: 'checkbox',
value: index,
id: 'char' + index
});
checkbox.change(update_value);
checkbox.appendTo('#chars');
var text = $("<span>").text('test');
$('#char' + index).after("<br>").after(character);
});
});
function update_value() {
var value = 0;
for(var i=0; i<list.length; i++) {
if ($('#char' + i).is(':checked')) {
value += Math.pow(2, i);
}
}
$('#value').text(value);
}
</script>
<style>
body {
font-family: verdana;
}
</style>
</head>
<body>
<h1>choose your characters</h1>
<div id="chars">
</div>
<p>value: <span id="value">...</span></p>
</body>
</html>
73 changes: 63 additions & 10 deletions manip.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,20 @@ static uint8_t ALLSTAR_TABLE_TEMP[24] = {
0xC5, 0xC6, 0xC7, 0xC9 //, 0xC8 (never changes spot)
};

void init_pick3_arrays(Array* from, Array* picked, int player_external_id) {
void init_tt_arrays(Array* from, Array* picked, int player_external_id) {
//
static int tt_characters[] =
{0x00, 0x01, 0x02, 0x04, 0x05, 0x06, 0x08,
0x0b, 0x0c, 0x0d, 0x0e, 0x10, 0x11, 0x12};
initArray(from, 14);
initArray(picked, 4);
for (int i=0; i<14; i++) {
if (tt_characters[i] != player_external_id)
insertArray(from, tt_characters[i]);
}
}

void init_tt3_arrays(Array* from, Array* picked, int player_external_id) {
initArray(from, 24);
initArray(picked, 4);
for (int i=0; i<26; i++) {
Expand Down Expand Up @@ -394,7 +407,8 @@ typedef enum {
RAND_INT,
ALLSTAR,
MULTI,
PICK3
TT,
TT3
} CFG_CMD;

typedef struct {
Expand Down Expand Up @@ -566,23 +580,46 @@ void calculate_rng_distance(ConfigEntry *e, uint32_t base_seed) {
}
was_allstar = 1;
break;
case PICK3:
init_pick3_arrays(char_list_pick_from, char_list_picked, c->params[0]);
case TT:
init_tt_arrays(char_list_pick_from, char_list_picked, c->params[0]);
for (int p=0; p<3; p++) {
int pick_size = char_list_pick_from->used - char_list_picked->used;
rng_adv(&seed);
uint32_t pull_from = rng_int(&seed, pick_size);
uint32_t pick3_index = 0;
uint32_t tt_index = 0;
for (int q=0; q<char_list_pick_from->used; q++) {
if (char_list_pick_from->array[q] == -1) {
continue;
}
if (pick3_index == pull_from) {
if (tt_index == pull_from) {
insertArray(char_list_picked, char_list_pick_from->array[q]);
char_list_pick_from->array[q] = -1;
break;
}
pick3_index++;
tt_index++;
}
}
if (c->params[1] != char_list_picked->array[0]) failed = 1;
if (c->params[2] != char_list_picked->array[1]) failed = 1;
if (c->params[3] != char_list_picked->array[2]) failed = 1;
break;
case TT3:
init_tt3_arrays(char_list_pick_from, char_list_picked, c->params[0]);
for (int p=0; p<3; p++) {
int pick_size = char_list_pick_from->used - char_list_picked->used;
rng_adv(&seed);
uint32_t pull_from = rng_int(&seed, pick_size);
uint32_t tt3_index = 0;
for (int q=0; q<char_list_pick_from->used; q++) {
if (char_list_pick_from->array[q] == -1) {
continue;
}
if (tt3_index == pull_from) {
insertArray(char_list_picked, char_list_pick_from->array[q]);
char_list_pick_from->array[q] = -1;
break;
}
tt3_index++;
}
}
if (c->params[1] != char_list_picked->array[0]) failed = 1;
Expand Down Expand Up @@ -713,17 +750,33 @@ int rng_event_search(uint32_t seed, int quick) {
ConfigCommand *c = &e->commands[e->size++];
c->command = MULTI;
} else
if (strcmp("PICK3", command) == 0) {
if (strcmp("TT", command) == 0) {
char player[30], pick1[30], pick2[30], pick3[30];
sscanf(line, "TT %s%s%s%s",
player, pick1, pick2, pick3);
trimwhitespace(player);
trimwhitespace(pick1);
trimwhitespace(pick2);
trimwhitespace(pick3);
ConfigEntry *e = &db.entries[current_entry];
ConfigCommand *c = &e->commands[e->size++];
c->command = TT;
c->params[0] = reverse_external_id_character_lookup(player);
c->params[1] = reverse_external_id_character_lookup(pick1);
c->params[2] = reverse_external_id_character_lookup(pick2);
c->params[3] = reverse_external_id_character_lookup(pick3);
} else
if (strcmp("TT3", command) == 0) {
char player[30], pick1[30], pick2[30], pick3[30];
sscanf(line, "PICK3 %s%s%s%s",
sscanf(line, "TT3 %s%s%s%s",
player, pick1, pick2, pick3);
trimwhitespace(player);
trimwhitespace(pick1);
trimwhitespace(pick2);
trimwhitespace(pick3);
ConfigEntry *e = &db.entries[current_entry];
ConfigCommand *c = &e->commands[e->size++];
c->command = PICK3;
c->command = TT3;
c->params[0] = reverse_external_id_character_lookup(player);
c->params[1] = reverse_external_id_character_lookup(pick1);
c->params[2] = reverse_external_id_character_lookup(pick2);
Expand Down
9 changes: 6 additions & 3 deletions manip.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ DELAY 125
INT 128 1 127
INT 58 57 57

# PICK3 Valid Characters
# Trophy Tussle Valid Characters
# Note: You may only use one
# of each char for your
# four picks.
Expand Down Expand Up @@ -111,5 +111,8 @@ INT 58 57 57
# Pichu
# Ganondorf

NAME Example Event 47 Stuff
PICK3 Fox Kirby Pichu Roy
NAME Example Trophy Tussle 1 & 2 Stuff
TT Link Mario Kirby Pikachu

NAME Example Trophy Tussle 3 Stuff
TT3 Fox Kirby Pichu Roy

0 comments on commit 6d324e7

Please sign in to comment.