Skip to content

Commit

Permalink
スキル書習得数上限6→5 兵種ID上限127→255 #46
Browse files Browse the repository at this point in the history
  • Loading branch information
aera-ngmansion committed Dec 5, 2020
1 parent a2d7b68 commit 7a2bb50
Show file tree
Hide file tree
Showing 22 changed files with 246 additions and 459 deletions.
22 changes: 13 additions & 9 deletions Engine Hacks/_N/_Skills/_common/SkillBook/EA.txt
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
#include _config.txt

#define MAX_BOOK_DATA_NUM (6) //データ保存数。スキル書習得上限とは違う

pushSkill: //inがBookData
#incbin "push_skill.dmp"
POIN getSkill
POIN commonSkill
WORD (MAX_MANUAL_SKILL_NUM-1)
POIN getBookData
POIN setBookData
WORD MAX_MANUAL_SKILL_NUM
ALIGN 4

popSkill: //outがBookData
#incbin "pop_skill.dmp"
POIN getSkill
POIN commonSkill
WORD (MAX_MANUAL_SKILL_NUM-1)
POIN getBookData
POIN setBookData
WORD MAX_MANUAL_SKILL_NUM
ALIGN 4

getSkill: //outがスキルID
#incbin "get_bookskill.dmp"
POIN commonSkill
WORD (MAX_MANUAL_SKILL_NUM-1)
POIN getBookData
WORD MAX_MANUAL_SKILL_NUM
ALIGN 4

getBookData: //outがデータ
#incbin "get_book.dmp"
POIN commonSkill
WORD 5 //指定可能な最大のINDEX
WORD MAX_BOOK_DATA_NUM
ALIGN 4

setBookData:
#incbin "set_book.dmp"
POIN commonSkill
WORD 5 //指定可能な最大のINDEX
WORD MAX_BOOK_DATA_NUM
ALIGN 4

containsSkill:
Expand All @@ -43,6 +46,7 @@ POIN getSkill
POIN pushSkill
POIN popSkill
POIN commonSkill
WORD MAX_MANUAL_SKILL_NUM
ALIGN 4

commonSkill:
Expand Down
2 changes: 1 addition & 1 deletion Engine Hacks/_N/_Skills/_common/SkillBook/_config.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define MAX_MANUAL_SKILL_NUM (6)
#define MAX_MANUAL_SKILL_NUM (5) //最大5

#define SKILL_BOOK_01 PaviseID //0x1大盾
#define SKILL_BOOK_02 MiracleID //0x2祈り
Expand Down
17 changes: 7 additions & 10 deletions Engine Hacks/_N/_Skills/_common/SkillBook/get_book.s
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
@変更時はGetSkillも同時に修正する事

.thumb
@I r0 = ベースアドレス
@ r1 = 0 is Skill1, 1 is Skill2, ...
@O r0 = skillID
@O r0 = BookID
push {r4, lr}
mov r2, r0
mov r4, r1

ldr r3, MAX_MANUAL_SKILL_INDEX
ldr r3, MAX_BOOK_DATA_NUM
cmp r1, r3
bge false
@▼本処理
Expand All @@ -18,11 +16,10 @@
bl get_unitSkill
b end
expand:
@▼3-6スキル
@▼3-5スキル
bl get_unitSkillEx
b end
end:
@ bl DecodeSkill
.short 0xE000
false:
mov r0, #0
Expand All @@ -35,12 +32,12 @@ get_unitSkill:
beq two
one:
ldrh r0, [r3, #0x3A]
mov r1, #0x3F @111111b
mov r1, #0b111111
and r0, r1
b end_get_unitSkill
two:
ldrh r0, [r3, #0x3A]
ldr r1, =0xFC0 @111111000000b
ldr r1, =0b111111000000
and r0, r1
lsr r0, r0, #6
b end_get_unitSkill
Expand Down Expand Up @@ -97,7 +94,7 @@ six:
b true
nop
true:
mov r1, #0x3F @IDをビットマスク
mov r1, #0b111111 @IDをビットマスク
and r0, r1
end2:
bx lr
Expand All @@ -114,7 +111,7 @@ DecodeSkill:
add r3, #4
mov pc, r3

MAX_MANUAL_SKILL_INDEX = addr+4
MAX_BOOK_DATA_NUM = addr+4

.align
.ltorg
Expand Down
Binary file modified Engine Hacks/_N/_Skills/_common/SkillBook/get_bookskill.dmp
Binary file not shown.
135 changes: 22 additions & 113 deletions Engine Hacks/_N/_Skills/_common/SkillBook/get_bookskill.s
Original file line number Diff line number Diff line change
@@ -1,120 +1,29 @@
@変更時はGetBookも同時に修正する事

.thumb
@I r0 = ベースアドレス
@ r1 = 0 is Skill1, 1 is Skill2, ...
@O r0 = skillID
push {r4, lr}
mov r2, r0
mov r4, r1

ldr r3, MAX_MANUAL_SKILL_INDEX
cmp r1, r3
bge false
@▼本処理
cmp r1, #1
bgt expand
@▼1-2スキル
bl get_unitSkill
b end
expand:
@▼3-6スキル
bl get_unitSkillEx
b end
end:
bl DecodeSkill
.short 0xE000
false:
mov r0, #0
pop {r4, pc}


get_unitSkill:
mov r3, r0
cmp r1, #1
beq two
one:
ldrh r0, [r3, #0x3A]
mov r1, #0x3F @111111b
and r0, r1
b end_get_unitSkill
two:
ldrh r0, [r3, #0x3A]
ldr r1, =0xFC0 @111111000000b
and r0, r1
lsr r0, r0, #6
b end_get_unitSkill
end_get_unitSkill:
bx lr

get_unitSkillEx:
push {lr}
mov r0, r2
bl getExSkillBaseAdr
cmp r0, #0
beq falseEx @Exスキルは自軍のみ
mov r1, r4
bl getExSkillFromBaseAdr
falseEx:
pop {pc}

getExSkillFromBaseAdr:
@I r0 = ユニットのセーブベースアドレス
@ r1 = SkillIndex
@O r0 = SkillID
cmp r1, #2
beq three
cmp r1, #3
beq four
cmp r1, #4
beq five
cmp r1, #5
beq six
mov r0, #0
b end2
three:
ldrb r0, [r0]
b true
four:
ldrb r1, [r0]
lsr r1, r1, #6
ldrb r2, [r0, #1]
lsl r2, r2, #2
orr r1, r2
mov r0, r1
b true
five:
ldrb r2, [r0, #1]
lsr r2, r2, #4
ldrb r1, [r0, #2]
lsl r1, r1, #4
orr r2, r1
mov r0, r2
b true
six:
ldrb r0, [r0, #2]
lsr r0, r0, #2
b true
nop
true:
mov r1, #0x3F @IDをビットマスク
and r0, r1
end2:
bx lr

getExSkillBaseAdr:
ldr r3, addr+0
mov pc, r3
EncodeSkill:
ldr r3, addr+0
add r3, #2
mov pc, r3
DecodeSkill:
@I r0 = ベースアドレス
@ r1 = 0 is Skill1, 1 is Skill2, ...
@O r0 = skillID
push {lr}
bl GET_MAX_BOOKSKILL_NUM_R2
cmp r1, r2
bge END

bl GET_BOOK
bl DECODE_BOOK
pop {pc}
END:
mov r0, #0
pop {pc}

DECODE_BOOK:
ldr r3, addr+0
add r3, #4
mov pc, r3

MAX_MANUAL_SKILL_INDEX = addr+4
GET_BOOK:
ldr r3, addr+4
mov pc, r3
GET_MAX_BOOKSKILL_NUM_R2:
ldr r2, addr+8
bx lr

.align
.ltorg
Expand Down
Binary file modified Engine Hacks/_N/_Skills/_common/SkillBook/pop_skill.dmp
Binary file not shown.
Loading

0 comments on commit 7a2bb50

Please sign in to comment.