summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJessica Tölke <jtoelke@mail.upb.de>2013-01-26 21:03:49 +0100
committerJessica Tölke <jtoelke@mail.upb.de>2013-02-12 23:05:13 +0100
commit726a2d9c8707109d22f20074439d2047915f0d36 (patch)
treee6baa3d7d000296dea861eecd701b59767d0c39c
parentddb2a2750117aa9f476f88ce133372bd2f0ed798 (diff)
downloadserverdata-726a2d9c8707109d22f20074439d2047915f0d36.tar.gz
serverdata-726a2d9c8707109d22f20074439d2047915f0d36.tar.bz2
serverdata-726a2d9c8707109d22f20074439d2047915f0d36.tar.xz
serverdata-726a2d9c8707109d22f20074439d2047915f0d36.zip
Restructuring the quests saved in TMW_Quest: write conversion function.
This function moves the content of TMW_Quest into nibbles of other variables.
-rw-r--r--world/map/npc/functions/clear_vars.txt50
1 files changed, 50 insertions, 0 deletions
diff --git a/world/map/npc/functions/clear_vars.txt b/world/map/npc/functions/clear_vars.txt
index cc6f097d..9faef2be 100644
--- a/world/map/npc/functions/clear_vars.txt
+++ b/world/map/npc/functions/clear_vars.txt
@@ -143,6 +143,56 @@ L_Fix_Full:
return;
}
+// The variable TMW_Quest was used to save the progress in several subquests linearly.
+// The subquests are moved to different nibbles of other variables
+// to make it possible to do some of the quests in parallel.
+function|script|ClearVarTMW_Quest|{
+
+ if (TMW_Quest == 0) goto L_Done;
+ if (TMW_Quest < 7) goto L_Bernard_Mikhail;
+ if (TMW_Quest < 9) goto L_Sarah;
+ if (TMW_Quest < 11) goto L_Vincent;
+ if (TMW_Quest < 13) goto L_Sandra;
+ if (TMW_Quest < 41) goto L_Desert;
+
+L_Bandit:
+// move Banditt subquest into Nibble 0 of QUEST_Hurnscald
+ set @bandit, TMW_Quest - 40;
+ set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_0_MASK) | (@bandit << NIBBLE_0_SHIFT));
+ set TMW_Quest, TMW_Quest - @bandit;
+ set @bandit, 0;
+L_Desert:
+// move guard and miner subquest into Byte 2 (Nibble 4 and 5) of QUEST_SouthTulimshar
+ set @miners, TMW_Quest - 12;
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(BYTE_2_MASK) | (@miners << BYTE_2_SHIFT));
+ set TMW_Quest, TMW_Quest - @miners;
+ set @miners, 0;
+L_Sandra:
+// move Sandra subquest into Nibble 3 of QUEST_SouthTulimshar
+ set @sandra, TMW_Quest - 10;
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_3_MASK) | (@sandra << NIBBLE_3_SHIFT));
+ set TMW_Quest, TMW_Quest - @sandra;
+ set @sandra, 0;
+L_Vincent:
+// move Vincent subquest into Nibble 2 of QUEST_SouthTulimshar
+ set @vincent, TMW_Quest - 8;
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_2_MASK) | (@vincent << NIBBLE_2_SHIFT));
+ set TMW_Quest, TMW_Quest - @vincent;
+ set @vincent, 0;
+L_Sarah:
+// move Sarah subquest into Nibble 1 of QUEST_SouthTulimshar
+ set @sarah, TMW_Quest - 6;
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_1_MASK) | (@sarah << NIBBLE_1_SHIFT));
+ set TMW_Quest, TMW_Quest - @sarah;
+ set @sarah, 0;
+L_Bernard_Mikhail:
+// move Bernard and Mikhail subquest into Nibble 0 of QUEST_SouthTulimshar
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_0_MASK) | (TMW_Quest << NIBBLE_0_SHIFT));
+ set TMW_Quest, 0;
+L_Done:
+ return;
+}
+
-|script|#ClearGlobalVars|-1,{
OnInit: