Esempio n. 1
0
 static void atl(int s, int, BS &b) {
     if (b.gen() > 4)
         return;
     /* Last move used is here not to take "special occurence" moves */
     poke(b,s)["ChoiceMemory"] = poke(b,s)["LastMoveUsed"];
 }
Esempio n. 2
0
void PokeEdit::changeItem(const QString &itemName)
{
    int itemNum = ItemInfo::Number(itemName);
    poke().item() = itemNum;
    if (poke().num() == Pokemon::Giratina && itemNum == Item::GriseousOrb && PokemonInfo::Released(Pokemon::Giratina_O, poke().gen())) {
        setNum(Pokemon::Giratina_O); 
    } else if (poke().num() == Pokemon::Giratina_O && itemNum != Item::GriseousOrb) {
        setNum(Pokemon::Giratina); 
    } else if (itemNum == Item::GriseousOrb && poke().gen() <= 4 && poke().num().pokenum != Pokemon::Giratina) {
        poke().item() = 0;
    }
    if (poke().num().pokenum == Pokemon::Arceus) {
        int subnum = ItemInfo::isPlate(itemNum) ? ItemInfo::PlateType(itemNum) : 0;
        setNum(Pokemon::uniqueId(poke().num().pokenum, subnum));
    }
    if (poke().num().pokenum == Pokemon::Genesect) {
        int subnum = ItemInfo::isDrive(itemNum) ? ItemInfo::DriveForme(itemNum) : 0;
        setNum(Pokemon::uniqueId(poke().num().pokenum, subnum));
    }
    if (itemNum != ItemInfo::StoneForForme(poke().num())) {
        if (PokemonInfo::IsMegaEvo(poke().num()) && !PokeEdit::hackMons) {
            setNum(Pokemon::uniqueId(poke().num().pokenum,0));
        }
    }
    updateItemSprite(poke().item());
    emit itemChanged();
}
Esempio n. 3
0
File: proc.c Progetto: m6502/pceas
void
do_call(int *ip)
{
	struct t_proc *ptr;
	int value;

	/* define label */
	labldef(loccnt, 1);

	/* update location counter */
	data_loccnt = loccnt;
	loccnt += 3;

	/* generate code */
	if (pass == LAST_PASS) {
		/* skip spaces */
		while (isspace(prlnbuf[*ip]))
			(*ip)++;

		/* extract name */
		if (!colsym(ip)) {
			if (symbol[0] == 0)
				fatal_error("Syntax error!");
			return;
		}

		/* check end of line */
		check_eol(ip);

		/* lookup proc table */
		if((ptr = proc_look())) {
			/* check banks */
			if (bank == ptr->bank)
				value = ptr->org + 0xA000;
			else {
				/* different */
				if (ptr->call)
					value = ptr->call;
				else {
					/* new call */
					value = call_ptr + 0x8000;
					ptr->call = value;

					/* init */
					if (call_ptr == 0) {
						call_bank = ++max_bank;
					}

					/* install */
					poke(call_ptr++, 0xA8);			// tay
					poke(call_ptr++, 0x43);			// tma #5
					poke(call_ptr++, 0x20);
					poke(call_ptr++, 0x48);			// pha
					poke(call_ptr++, 0xA9);			// lda #...
					poke(call_ptr++, ptr->bank+bank_base);
					poke(call_ptr++, 0x53);			// tam #5
					poke(call_ptr++, 0x20);
					poke(call_ptr++, 0x98);			// tya
					poke(call_ptr++, 0x20);			// jsr ...
					poke(call_ptr++, (ptr->org & 0xFF));
					poke(call_ptr++, (ptr->org >> 8) + 0xA0);
					poke(call_ptr++, 0xA8);			// tay
					poke(call_ptr++, 0x68);			// pla
					poke(call_ptr++, 0x53);			// tam #5
					poke(call_ptr++, 0x20);
					poke(call_ptr++, 0x98);			// tya
					poke(call_ptr++, 0x60);			// rts
				}
			}
		}
		else {
			/* lookup symbol table */
			if ((lablptr = stlook(0)) == NULL) {
				fatal_error("Undefined destination!");
				return;
			}

			/* get symbol value */
			value = lablptr->value;
		}

		/* opcode */
		putbyte(data_loccnt, 0x20);
		putword(data_loccnt+1, value);

		/* output line */
		println();
	}
Esempio n. 4
0
void PokeEdit::updateGender()
{
    ui->genderSprite->setPixmap(Theme::GenderPicture(poke().gender()));
}
Esempio n. 5
0
void PokeEdit::setNum(Pokemon::uniqueId num)
{
    if (num == poke().num()) {
        return;
    }

    bool sameForme = num.pokenum == poke().num().pokenum;

    if (!sameForme) {
        poke().reset();
    }

    if (!PokeEdit::hackMons) {
        if (num.pokenum == Pokemon::Keldeo) {
            if (num == Pokemon::Keldeo_R && !poke().hasMove(Move::SecretSword)) {
                try {
                    poke().addMove(Move::SecretSword);
                } catch(const QString &) {
                    poke().setMove(Move::SecretSword, 0, false);
                }
            } else if (PokemonInfo::Released(Pokemon::Keldeo_R, poke().gen())) {
                if (poke().gen() < 6)
                    poke().removeMove(Move::SecretSword);
            }
        } else if (num.pokenum == Pokemon::Giratina) {
            if (num == Pokemon::Giratina_O && poke().item() != Item::GriseousOrb) {
                poke().item() = Item::GriseousOrb;
            } else if (num == Pokemon::Giratina && poke().item() == Item::GriseousOrb) {
                poke().item() = Item::NoItem;
            }
        } else if (num.pokenum == Pokemon::Arceus && ItemInfo::PlateType(poke().item()) != num.subnum) {
            poke().item() = ItemInfo::PlateForType(num.subnum);
        } else if (num.pokenum == Pokemon::Genesect && ItemInfo::DriveForme(poke().item()) != num.subnum) {
            poke().item() = ItemInfo::DriveForForme(num.subnum);
        } else if (PokemonInfo::IsMegaEvo(num)) {
            poke().item() = ItemInfo::StoneForForme(num);
            /*Override using the mega until there's a better solution.*/
            num = Pokemon::uniqueId(num.pokenum, 0);
        }
    }

    poke().setNum(num);
    poke().load();

    if (PokemonInfo::IsMegaEvo(num) && !PokeEdit::hackMons) {
        poke().nickname() = PokemonInfo::Name(Pokemon::uniqueId(num.pokenum, 0));
    } else {
        poke().nickname() = PokemonInfo::Name(num);
    }

    if (sameForme) {
        poke().runCheck(PokeEdit::hackMons);
    }

    emit numChanged();
    updateAll();
}
void TB_PokemonBody::updateGender()
{
    widget->setGender(poke()->gender());
}
Esempio n. 7
0
void PokeEdit::updateAll()
{
    ui->pokemonSprite->setPixmap(poke().picture());
    ui->nickname->setText(poke().nickname());
    ui->type1->setPixmap(Theme::TypePicture(poke().type1()));
    ui->type2->setPixmap(Theme::TypePicture(poke().type2()));
    ui->speciesLabel->setText(PokemonInfo::Name(poke().num()));
    ui->genderSprite->setPixmap(Theme::GenderPicture(poke().gender()));
    ui->happiness->setValue(poke().happiness());
    ui->nature->setCurrentIndex(poke().nature());
    setItem(poke().item());
    ui->levelSettings->updateAll();
    ui->evbox->updateAll();
    ui->ivbox->updateAll();

    movesModel->setPokemon(poke().num(), poke().gen());

    for (int i = 0; i < 4; i++) {
        if (poke().move(i) != 0) {
            m_moves[i]->setText(MoveInfo::Name(poke().move(i)));
        } else {
            m_moves[i]->clear();
        }
    }

    ui->type2->setVisible(poke().type2() != Type::Curse);
    ui->genderSprite->setVisible(poke().gender() != Pokemon::Neutral);

    bool g1 = poke().gen().num == 1;
    ui->happiness->setVisible(!g1);
    ui->item->setVisible(!g1);
    ui->itemLabel->setVisible(!g1);
    ui->happinessLabel->setVisible(!g1);
    ui->genderSprite->setVisible(!g1);

    bool g2 = poke().gen().num <= 2;
    ui->natureLabel->setVisible(!g2);
    ui->nature->setVisible(!g2);

    updatePluginLayout();
}
Esempio n. 8
0
 static void us(int s, int, BS &b) {
     poke(b,s).remove("ChoiceMemory");
 }
Esempio n. 9
0
void aggregator_schema()
{
	AssocOf(Assoc) aggregator_feed;
	aggregator_feed["#spec"]["description"] = "Stores feeds to be parsed by the aggregator.";
	aggregator_feed["#spec"]["name"] = "aggregator_feed";
	aggregator_feed["fid"]["type"] = "serial";
	aggregator_feed["fid"]["not null"] = _TRUE;
	aggregator_feed["fid"]["description"] = "Primary Key: Unique feed ID.";
	aggregator_feed["title"]["type"] = "varchar";
	aggregator_feed["title"]["length"] = "255";
	aggregator_feed["title"]["not null"] = _TRUE;
	aggregator_feed["title"]["default"] = "";
	aggregator_feed["title"]["description"] = "Title of the feed.";
	aggregator_feed["url"]["type"] = "varchar";
	aggregator_feed["url"]["length"] = "255";
	aggregator_feed["url"]["not null"] = _TRUE;
	aggregator_feed["url"]["default"] = "";
	aggregator_feed["url"]["description"] = "URL to the feed.";
	aggregator_feed["refresh"]["type"] = "int";
	aggregator_feed["refresh"]["not null"] = _TRUE;
	aggregator_feed["refresh"]["default"] = "0";
	aggregator_feed["refresh"]["description"] = "How often to check for new feed items, in seconds.";
	aggregator_feed["livetime"]["type"] = "int";
	aggregator_feed["livetime"]["not null"] = _TRUE;
	aggregator_feed["livetime"]["default"] = "1209600"; // 2 Weeks
	aggregator_feed["livetime"]["description"] = "Live time of the feed, as a Unix timestamp.";
	aggregator_feed["checked"]["type"] = "int";
	aggregator_feed["checked"]["not null"] = _TRUE;
	aggregator_feed["checked"]["default"] = "0";
	aggregator_feed["checked"]["description"] = "Last time feed was checked for new items, as Unix timestamp.";
	aggregator_feed["link"]["type"] = "varchar";
	aggregator_feed["link"]["length"] = "255";
	aggregator_feed["link"]["not null"] = _TRUE;
	aggregator_feed["link"]["default"] = "";
	aggregator_feed["link"]["description"] = "The parent website of the feed; comes from the &lt;link&gt; element in the feed.";
	aggregator_feed["description"]["type"] = "text";
	aggregator_feed["description"]["not null"] = _TRUE;
	aggregator_feed["description"]["size"] = "big";
	aggregator_feed["description"]["description"] = "The parent website's description; comes from the &lt;description&gt; element in the feed.";
	aggregator_feed["image"]["type"] = "text";
	aggregator_feed["image"]["not null"] = _TRUE;
	aggregator_feed["image"]["size"] = "big";
	aggregator_feed["image"]["description"] = "An image representing the feed.";
	aggregator_feed["etag"]["type"] = "varchar";
	aggregator_feed["etag"]["length"] = "255";
	aggregator_feed["etag"]["not null"] = _TRUE;
	aggregator_feed["etag"]["default"] = "";
	aggregator_feed["etag"]["description"] = "Entity tag HTTP response header, used for validating cache.";
	aggregator_feed["modified"]["type"] = "int";
	aggregator_feed["modified"]["not null"] = _TRUE;
	aggregator_feed["modified"]["default"] = "0";
	aggregator_feed["modified"]["description"] = "When the feed was last modified, as a Unix timestamp.";
	aggregator_feed["block"]["type"] = "int";
	aggregator_feed["block"]["not null"] = _TRUE;
	aggregator_feed["block"]["default"] = "0";
	aggregator_feed["block"]["size"] = "tiny";
	aggregator_feed["block"]["description"] = "Number of items to display in the feed's block.";
	aggregator_feed["#primary key"]["fid"] = "fid";
	aggregator_feed["#unique keys"]["url"] = "url";
	aggregator_feed["#unique keys"]["title"] = "title";
	poke( schema, aggregator_feed );

	AssocOf(Assoc) aggregator_item;
	aggregator_item["#spec"]["description"] = "Stores the individual items imported from feeds.";
	aggregator_item["#spec"]["name"] = "aggregator_item";
	aggregator_item["iid"]["type"] = "serial";
	aggregator_item["iid"]["not null"] = _TRUE;
	aggregator_item["iid"]["description"] = "Primary Key: Unique ID for feed item.";
	aggregator_item["fid"]["type"] = "int";
	aggregator_item["fid"]["not null"] = _TRUE;
	aggregator_item["fid"]["default"] = "0";
	aggregator_item["fid"]["description"] = "The {aggregator_feed}.fid to which this item belongs.";
	aggregator_item["title"]["type"] = "varchar";
	aggregator_item["title"]["length"] = "255";
	aggregator_item["title"]["not null"] = _TRUE;
	aggregator_item["title"]["default"] = "";
	aggregator_item["title"]["description"] = "Title of the feed item.";
	aggregator_item["link"]["type"] = "varchar";
	aggregator_item["link"]["length"] = "255";
	aggregator_item["link"]["not null"] = _TRUE;
	aggregator_item["link"]["default"] = "";
	aggregator_item["link"]["description"] = "Link to the feed item.";
	aggregator_item["author"]["type"] = "varchar";
	aggregator_item["author"]["length"] = "255";
	aggregator_item["author"]["not null"] = _TRUE;
	aggregator_item["author"]["default"] = "";
	aggregator_item["author"]["description"] = "Author of the feed item.";
	aggregator_item["description"]["type"] = "text";
	aggregator_item["description"]["not null"] = _TRUE;
	aggregator_item["description"]["size"] = "big";
	aggregator_item["description"]["description"] = "Body of the feed item.";
	aggregator_item["timestamp"]["type"] = "int";
	aggregator_item["timestamp"]["not null"] = _FALSE;
	aggregator_item["timestamp"]["description"] = "Post date of feed item, as a Unix timestamp.";
	aggregator_item["livetime"]["type"] = "int";
	aggregator_item["livetime"]["not null"] = _TRUE;
	aggregator_item["livetime"]["default"] = "1209600"; // 2 Weeks
	aggregator_item["livetime"]["description"] = "Live time of feed item, as a Unix timestamp.";
	aggregator_item["guid"]["type"] = "varchar";
	aggregator_item["guid"]["length"] = "255";
	aggregator_item["guid"]["not null"] = _FALSE;
	aggregator_item["guid"]["description"] = "Unique identifier for the feed item.";
	aggregator_item["#primary key"]["iid"] = "iid";
    aggregator_item["#indexes"]["fid"] = "fid";
	poke( schema, aggregator_item );
}
Esempio n. 10
0
 static void m2m(int s, int, BS &b) {
     turn(b,s)["ItemMod2Modifier"] = poke(b,s)["IMMetroCount"];
 }
Esempio n. 11
0
 static void as(int s, int, BS &b) {
     bool used = false;
     if (poke(b,s).contains("AttractedTo")) {
         int seducer = poke(b,s)["AttractedTo"].toInt();
         if (poke(b,seducer).contains("Attracted") && poke(b,seducer)["Attracted"].toInt() == s) {
             removeFunction(poke(b,s), "DetermineAttackPossible", "Attract");
             poke(b,s).remove("AttractedTo");
             used = true;
         }
     }
     if (b.gen() >= 5) {
         if (poke(b,s).contains("Tormented")) {
             removeFunction(poke(b,s), "MovesPossible", "Torment");
             poke(b,s).remove("Tormented");
             used = true;
         }
         if (b.counters(s).hasCounter(BC::Taunt)) {
             removeFunction(poke(b,s), "MovesPossible", "Taunt");
             removeFunction(poke(b,s), "MovePossible", "Taunt");
             b.removeEndTurnEffect(BS::PokeEffect, s, "Taunt");
             used = true;
         }
         if (b.counters(s).hasCounter(BC::Encore)) {
             removeFunction(poke(b,s), "MovesPossible", "Encore");
             b.removeEndTurnEffect(BS::PokeEffect, s, "Encore");
             used = true;
         }
         if (b.counters(s).hasCounter(BC::Disable)) {
             removeFunction(poke(b,s), "MovesPossible", "Disable");
             removeFunction(poke(b,s), "MovePossible", "Disable");
             b.removeEndTurnEffect(BS::PokeEffect, s, "Disable");
             used = true;
         }
         b.counters(s).clear();
     }
     if (used) {
         b.sendItemMessage(7,s);
         b.disposeItem(s);
     }
 }
Esempio n. 12
0
 static void btl(int s, int, BS &b) {
     if (b.pokenum(s).pokenum == poke(b,s)["ItemArg"].toInt()) {
         tmove(b,s).critRaise += 2;
     }
 }
Esempio n. 13
0
 static void bpm(int s, int, BS &b) {
     if (tmove(b,s).category == poke(b,s)["ItemArg"]) {
         b.chainBp(s, 2);
     }
 }
Esempio n. 14
0
 static void sm(int s, int, BS &b) {
     QString args = poke(b,s)["ItemArg"].toString();
     turn(b,s)["Stat" + args.left(1) + "ItemModifier"] = args.mid(2).toInt();
 }
Esempio n. 15
0
void TB_PokemonBody::updateLevel()
{
    widget->setLevel(poke()->level());
}
Esempio n. 16
0
/*
 * Parse an Intel HEX image file and invoke the poke() function on the
 * various segments to implement policies such as writing to RAM (with
 * a one or two stage loader setup, depending on the firmware) or to
 * EEPROM (two stages required).
 *
 * image       - the hex image file
 * context     - for use by poke()
 * is_external - if non-null, used to check which segments go into
 *               external memory (writable only by software loader)
 * poke        - called with each memory segment; errors indicated
 *               by returning negative values.
 *
 * Caller is responsible for halting CPU as needed, such as when
 * overwriting a second stage loader.
 */
static int parse_ihex(FILE *image, void *context,
	bool (*is_external)(uint32_t addr, size_t len),
	int (*poke) (void *context, uint32_t addr, bool external,
	const unsigned char *data, size_t len))
{
	unsigned char data[1023];
	uint32_t data_addr = 0;
	size_t data_len = 0;
	int rc;
	int first_line = 1;
	bool external = false;

	/* Read the input file as an IHEX file, and report the memory segments
	 * as we go.  Each line holds a max of 16 bytes, but uploading is
	 * faster (and EEPROM space smaller) if we merge those lines into larger
	 * chunks.  Most hex files keep memory segments together, which makes
	 * such merging all but free.  (But it may still be worth sorting the
	 * hex files to make up for undesirable behavior from tools.)
	 *
	 * Note that EEPROM segments max out at 1023 bytes; the upload protocol
	 * allows segments of up to 64 KBytes (more than a loader could handle).
	 */
	for (;;) {
		char buf[512], *cp;
		char tmp, type;
		size_t len;
		unsigned idx, off;

		cp = fgets(buf, sizeof(buf), image);
		if (cp == NULL) {
			logerror("EOF without EOF record!\n");
			break;
		}

		/* EXTENSION: "# comment-till-end-of-line", for copyrights etc */
		if (buf[0] == '#')
			continue;

		if (buf[0] != ':') {
			logerror("not an ihex record: %s", buf);
			return -2;
		}

		/* ignore any newline */
		cp = strchr(buf, '\n');
		if (cp)
			*cp = 0;

		if (verbose >= 3)
			logerror("** LINE: %s\n", buf);

		/* Read the length field (up to 16 bytes) */
		tmp = buf[3];
		buf[3] = 0;
		len = strtoul(buf+1, NULL, 16);
		buf[3] = tmp;

		/* Read the target offset (address up to 64KB) */
		tmp = buf[7];
		buf[7] = 0;
		off = (int)strtoul(buf+3, NULL, 16);
		buf[7] = tmp;

		/* Initialize data_addr */
		if (first_line) {
			data_addr = off;
			first_line = 0;
		}

		/* Read the record type */
		tmp = buf[9];
		buf[9] = 0;
		type = (char)strtoul(buf+7, NULL, 16);
		buf[9] = tmp;

		/* If this is an EOF record, then make it so. */
		if (type == 1) {
			if (verbose >= 2)
				logerror("EOF on hexfile\n");
			break;
		}

		if (type != 0) {
			logerror("unsupported record type: %u\n", type);
			return -3;
		}

		if ((len * 2) + 11 > strlen(buf)) {
			logerror("record too short?\n");
			return -4;
		}

		/* FIXME check for _physically_ contiguous not just virtually
		 * e.g. on FX2 0x1f00-0x2100 includes both on-chip and external
		 * memory so it's not really contiguous */

		/* flush the saved data if it's not contiguous,
		* or when we've buffered as much as we can.
		*/
		if (data_len != 0
			&& (off != (data_addr + data_len)
			/* || !merge */
			|| (data_len + len) > sizeof(data))) {
				if (is_external)
					external = is_external(data_addr, data_len);
				rc = poke(context, data_addr, external, data, data_len);
				if (rc < 0)
					return -1;
				data_addr = off;
				data_len = 0;
		}

		/* append to saved data, flush later */
		for (idx = 0, cp = buf+9 ;  idx < len ;  idx += 1, cp += 2) {
			tmp = cp[2];
			cp[2] = 0;
			data[data_len + idx] = (uint8_t)strtoul(cp, NULL, 16);
			cp[2] = tmp;
		}
		data_len += len;
	}


	/* flush any data remaining */
	if (data_len != 0) {
		if (is_external)
			external = is_external(data_addr, data_len);
		rc = poke(context, data_addr, external, data, data_len);
		if (rc < 0)
			return -1;
	}
	return 0;
}
Esempio n. 17
0
void TB_PokemonBody::updateImage()
{
    widget->setPicture(poke()->picture());
}
void kernelMain(void) {
    putStr("\nstarting kernel\n");

    initGdt();
    initTss();
    initIdt();

    putStr("mapping the first 2M with va = pa\n");

    for (uint32_t p = 0; p < 0x200000; p += 4096) {
        vmm_map(p,p);
    }

    CHECK((getcr0() & 0x80000000) == 0);

    putStr("about to enable paging\n");
    vmm_on();

    CHECK((getcr0() & 0x80000000) != 0);

    CHECK (vmm_pa(0xf0000000) == 0xffffffff);

    uint32_t pa = vmm_frame();
    vmm_map(0xf0000000, pa);

    CHECK (vmm_pa(0xf0000000) != 0xffffffff);
    CHECK ((vmm_pa(0xf0000123) & 0xfff) == 0x123);

    CHECK(vmm_dirty(0xf0000000) == 0); 
    CHECK(vmm_accessed(0xf0000000) == 0); 

    CHECK(peek(0xf0000000) == 0);
    CHECK(vmm_dirty(0xf0000000) == 0); 
    CHECK(vmm_accessed(0xf0000000) == 1); 

    poke(0xf0000000, 0x12345678);
    CHECK(peek(0xf0000000) == 0x12345678);
    CHECK(vmm_dirty(0xf0000000) == 1); 
    CHECK(vmm_accessed(0xf0000000) == 1); 

    CHECK(vmm_dirty(0xe0000000) == 0); 
    CHECK(vmm_accessed(0xe0000000) == 0); 

    CHECK(vmm_pa(0x40000000) == 0xffffffff);

    vmm_map(0xe0000000, pa);
    CHECK(peek(0xe0000000) == 0x12345678);

    CHECK(vmm_dirty(0xe0000000) == 0); 
    CHECK(vmm_accessed(0xe0000000) == 1); 

    CHECK(peek(0x44444444) == 0);
    CHECK(vmm_dirty(0x44444000) == 0); 
    CHECK(vmm_accessed(0x44443000) == 0); 
    CHECK(vmm_accessed(0x44444000) == 1); 
    CHECK(vmm_accessed(0x44445000) == 0); 

    poke(0x88888888,0x88888888);
    CHECK(peek(0x88888888) == 0x88888888);

    vmm_map(0xccccc000, vmm_pa(0x88888000));
    CHECK(peek(0xccccc888) == 0x88888888);

    CHECK (vmm_pa(0xccccc666) == vmm_pa(0x88888666));

    vmm_unmap(0xccccc000);
    CHECK(peek(0xccccc888) == 0);
    CHECK(peek(0x88888888) == 0x88888888);

    shutdown();
}
Esempio n. 19
0
void PokeEdit::on_nickname_textChanged(const QString &s)
{
    poke().nickname() = s;

    emit nameChanged();
}
Esempio n. 20
0
void TB_PokemonBody::updateItem()
{
    if (widget) {
        widget->setItem(poke()->item());
    }
}
Esempio n. 21
0
void PokeEdit::updatePicture()
{
    ui->pokemonSprite->setPixmap(poke().picture());
}
Esempio n. 22
0
void TB_PokemonBody::setNick(const QString &nick)
{
    poke()->nickname() = nick;
    emit nicknameChanged(nick);
}
Esempio n. 23
0
void PokeEdit::changeHappiness(int newHappiness)
{
    poke().happiness() = newHappiness;
}
Esempio n. 24
0
void TB_PokemonBody::setItem(int it)
{
    if (it == poke()->item()) {
        return;
    }

    if (PokemonInfo::OriginalForme(poke()->num()) == Pokemon::Arceus) {
        int type = 0;
        if (ItemInfo::isPlate(it)) {
            type = ItemInfo::PlateType(it);
        }

        if (type != poke()->num().subnum) {
            changeForme(Pokemon::uniqueId(poke()->num().pokenum, type));
        }
    }
    if (PokemonInfo::OriginalForme(poke()->num()) == Pokemon::Genesect) {
        int forme = 0;
        if (ItemInfo::isDrive(it)) {
            forme = ItemInfo::DriveForme(it);
        }

        if (forme != poke()->num().subnum) {
            changeForme(Pokemon::uniqueId(poke()->num().pokenum, forme));
        }
    }
    if (it == Item::GriseousOrb && poke()->num().pokenum != Pokemon::Giratina && gen() <= 4) {
        poke()->item() = 0;
        if (widget) {
            widget->setItem(0);
        }
    }
    else {
        poke()->item() = it;
        if (poke()->item() == Item::GriseousOrb) {
            if (poke()->num() == Pokemon::Giratina)
                changeForme(Pokemon::Giratina_O);
        } else if (poke()->num() == Pokemon::Giratina_O) {
            changeForme(Pokemon::Giratina);
        }
    }

    emit itemChanged(it);
}
Esempio n. 25
0
void PokeEdit::changeNature(int newNature)
{
    poke().nature() = newNature;
    updateStats();
}
Esempio n. 26
0
void TB_PokemonBody::setNature(int nature)
{
    poke()->nature() = nature;
}
Esempio n. 27
0
void jellyfish::run()
{
    // get pc
    s32 pc=peekix(REG_PCO)%m_heap_size;
    
    // fetch instruction
    vec3 c=peek(pc);
    s32 i=(int)c.x;
    s32 argiy=(int)c.y;
    s32 argiz=(int)c.z;

    set_instr(pc,true);

    //printf("%d",i);
    
	switch(i)
	{
    case NOP: break;
    case JMP: poke(REG_PCO,vec3(argiy-1,0,0)); break;
    case JMZ: if ((float)pop().x==0) poke(REG_PCO,vec3(pc+argiy,0,0)); break;
	case JLT: if (pop().x<pop().x) poke(REG_PCO,vec3(pc+argiy,0,0)); break;
    case JGT: if (pop().x>pop().x) poke(REG_PCO,vec3(pc+argiy,0,0)); break;
	case LDL: push(vec3(c.y,0,0)); break;
	case LDA: push(peek(argiy)+argiz); break;
	case LDI: push(peek(peekix(argiy)+argiz)); break;
	case STA: poke(argiy+argiz,pop()); break;
	case STI: poke(peekix(argiy)+argiz,pop()); break;
	case ADD: push(pop()+pop()); break;
	case SUB: push(pop()-pop()); break;
	case MUL: 
    {
        vec3 m=pop();
        vec3 v=pop();
        push(v*(float)m.x);
    } break;
	case DIV: { 
        float v=(float)pop().x;
        if (v!=0) {
            push(pop()/v); 
        } else {
            push(vec3(0,0,0));
        }
    } break;
	case ABS: { vec3 t=pop(); push(vec3(fabs((float)t.x),
                                        fabs((float)t.y),
                                        fabs((float)t.z))); } break;
	case SIN: { flx_real a=pop().x; push(vec3(sin(((float)a)*0.0174532925),
                                              cos(((float)a)*0.0174532925),0));
    } break;
	case ATN: ; break;
	case DOT: push(vec3(pop().dot(pop()),0,0)); break;
	case CRS: push(pop().cross(pop())); break;
	case SQR: push(vec3(sqrt((float)pop().x),0,0)); break;
	case LEN: push(vec3(pop().mag(),0,0)); break;
	case DUP: push(top()); break;
	case CMP: push(vec3(pop().x,pop().x,pop().x)); break;
	case SHF: 
    { 
        vec3 shf=pop(); 
        vec3 src=pop();
        vec3 dst;        
        dst.x=(&src.x)[((int)fabs(shf.x))%3];
        if ((float)shf.x<0) dst.x=-dst.x;
        dst.y=(&src.x)[((int)fabs(shf.y))%3];
        if ((float)shf.y<0) dst.y=-dst.y;
        dst.z=(&src.x)[((int)fabs(shf.z))%3];
        if ((float)shf.z<0) dst.z=-dst.z;
        push(dst);
    } break;
	case BLD: 
    {
        vec3 ret;
        for (int i=0; i<3; i++)
        {
            vec3 t=peek(argiy);
            ret.x=(&t.x)[argiz];
        }
        push(ret);
    } break;
	case RET: poke(REG_PCO,vec3((int)pop().x,0,0)); break;
    default: set_instr(pc,false);
   	};



//    print_instr(pc);
//    printf("\n");
    
    // inc pc 
    // todo - speed?
    poke(REG_PCO,peek(REG_PCO)+vec3(1,0,0));
}
Esempio n. 28
0
int TB_PokemonBody::gen()
{
    return poke()->gen();
}
Esempio n. 29
0
void EvBox::updateMain()
{
    ui->totalslider->setValue(poke().EVSum());
    ui->totallabel->setText(QString::number(poke().EVSum()));
}
Esempio n. 30
0
void IvBox::updateAll()
{
    // Abilities.

    for(int i = 0; i < 3; i++) {
        if(poke().abilities().ab(i) != 0 && poke().gen() >= 3 && (i == 0 || poke().abilities().ab(i) != poke().abilities().ab(0))) {
            m_abilities[i]->setVisible(true);
            m_abilities[i]->setText(AbilityInfo::Name(poke().abilities().ab(i)));
            m_abilities[i]->setToolTip(AbilityInfo::Desc(poke().abilities().ab(i)));

            if (poke().abilities().ab(i) == poke().ability()) {
                m_abilities[i]->setChecked(true);
            }
        } else {
             m_abilities[i]->setVisible(false);
        }
    }
    updateIVs();
    updateStats();
    updateHiddenPower();

    if (poke().gen() <= 2) {
        ui->abilityTitle->setVisible(false);

        ui->hpivspin->setDisabled(true);
        ui->spdefivspin->setDisabled(true);

        for (int i = 0; i < 6; i++) {
            m_ivchangers[i]->setRange(0, 15);
        }
    } else {
        ui->abilityTitle->setVisible(true);

        ui->hpivspin->setDisabled(false);
        ui->spdefivspin->setDisabled(false);

        for (int i = 0; i < 6; i++) {
            m_ivchangers[i]->setRange(0, 31);
        }
    }

    if (poke().gen() <= 1) {
        ui->hiddenPowerPower->setVisible(false);
        ui->hiddenPowerTitle->setVisible(false);
        ui->hiddenPowerType->setVisible(false);

        ui->spdefivdesc->hide();
        ui->spdefivlabel->hide();
        ui->spdefivspin->hide();
        ui->spattivdesc->setText(tr("Special: "));
    } else {
        ui->hiddenPowerPower->setVisible(true);
        ui->hiddenPowerTitle->setVisible(true);
        ui->hiddenPowerType->setVisible(true);

        ui->spdefivdesc->setVisible(true);
        ui->spdefivlabel->setVisible(true);
        ui->spdefivspin->setVisible(true);
        ui->spattivdesc->setText(tr("Sp. Atk: "));
    }
}