Skip to content

Commit

Permalink
Merge pull request #23 from TML233/develop
Browse files Browse the repository at this point in the history
v0.2.0
  • Loading branch information
TML233 committed Apr 17, 2019
2 parents f3c1499 + 1900fec commit 6f7be68
Show file tree
Hide file tree
Showing 63 changed files with 729 additions and 173 deletions.
7 changes: 6 additions & 1 deletion objects/battle/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,13 @@ _menu_choice_action=0;
_menu_choice_item=0;
_menu_choice_item_first=0;
_menu_choice_mercy=0;
_menu_choice_mercy_override=false;
_menu_choice_mercy_override_number=1;
_menu_choice_mercy_override_name[0]="";
_menu_choice_mercy_override_name[1]="";
_menu_choice_mercy_override_name[2]="";
_menu_fleeable=false;
_menu_flee_enabled=Encounter_IsMenuFleeEnabled(ENCOUNTER);
_menu_mercy_flee_enabled=Encounter_IsMenuMercyFleeEnabled(ENCOUNTER);
_menu_dialog=Encounter_GetMenuDialog(ENCOUNTER);

_menu_fight_damage=0;
Expand Down
4 changes: 3 additions & 1 deletion objects/battle/Step_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ if(_state==BATTLE_STATE.MENU){
}
}else if(Input_CheckPressed(INPUT.DOWN)){
var mercy=Battle_GetMenuChoiceMercy()+1;
if(mercy<=_menu_flee_enabled){
if((!Battle_IsMenuChoiceMercyOverride()&&mercy<=_menu_mercy_flee_enabled) || (Battle_IsMenuChoiceMercyOverride()&&mercy<Battle_GetMenuChoiceMercyOverrideNumber())){
audio_play_sound(snd_menu_switch,0,false);
Battle_SetMenuChoiceMercy(mercy);
}
Expand All @@ -231,6 +231,8 @@ if(_state==BATTLE_STATE.MENU){
Battle_EndMenu(BATTLE_MENU_RESULT.SPARE);
}else if(_menu_choice_mercy==1){
Battle_EndMenu(BATTLE_MENU_RESULT.FLEE);
}else{
Battle_EndMenu(BATTLE_MENU_RESULT.SPARE);
}
}
}
Expand Down
21 changes: 21 additions & 0 deletions objects/closed_captions/Create_0.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
depth=DEPTH_UI.PANEL;

_x=320;
_y=400;
_up=20;
_down=0;
_left=250;
_right=250;
_color=c_black;
_alpha=0;
_alpha_base=0.6;

_queue_text=ds_queue_create();
_queue_duration=ds_queue_create();
_list_inst=ds_list_create();
_list_time=ds_list_create();
_list_destroy_inst=ds_list_create();
_list_destroy_time=ds_list_create();

_showed=false;
_up_previous=_up;
21 changes: 21 additions & 0 deletions objects/closed_captions/Draw_64.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//四角
//左上
draw_sprite_ext(spr_closed_captions_corner,0,_x-_left-sprite_get_width(spr_closed_captions_corner),_y-_up-sprite_get_height(spr_closed_captions_corner),1,1,0,_color,_alpha_base*_alpha);
//左下
draw_sprite_ext(spr_closed_captions_corner,0,_x-_left-sprite_get_width(spr_closed_captions_corner),_y+_down+sprite_get_height(spr_closed_captions_corner),1,-1,0,_color,_alpha_base*_alpha);
//右上
draw_sprite_ext(spr_closed_captions_corner,0,_x+_right+sprite_get_width(spr_closed_captions_corner),_y-_up-sprite_get_height(spr_closed_captions_corner),-1,1,0,_color,_alpha_base*_alpha);
//右下
draw_sprite_ext(spr_closed_captions_corner,0,_x+_right+sprite_get_width(spr_closed_captions_corner),_y+_down+sprite_get_height(spr_closed_captions_corner),-1,-1,0,_color,_alpha_base*_alpha);

//填充
//
draw_sprite_ext(spr_pixel,0,_x-_left-sprite_get_width(spr_closed_captions_corner),_y-_up,sprite_get_width(spr_closed_captions_corner),_up+_down,0,_color,_alpha_base*_alpha);
//
draw_sprite_ext(spr_pixel,0,_x+_right,_y-_up,sprite_get_width(spr_closed_captions_corner),_up+_down,0,_color,_alpha_base*_alpha);
//
draw_sprite_ext(spr_pixel,0,_x-_left,_y-_up-sprite_get_height(spr_closed_captions_corner),_left+_right,sprite_get_height(spr_closed_captions_corner),0,_color,_alpha_base*_alpha);
//
draw_sprite_ext(spr_pixel,0,_x-_left,_y+_down,_left+_right,sprite_get_height(spr_closed_captions_corner),0,_color,_alpha_base*_alpha);
//中间
draw_sprite_ext(spr_pixel,0,_x-_left,_y-_up,_left+_right,_up+_down,0,_color,_alpha_base*_alpha);
6 changes: 6 additions & 0 deletions objects/closed_captions/Other_3.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ds_queue_destroy(_queue_text);
ds_queue_destroy(_queue_duration);
ds_list_destroy(_list_inst);
ds_list_destroy(_list_time);
ds_list_destroy(_list_destroy_inst);
ds_list_destroy(_list_destroy_time);
122 changes: 122 additions & 0 deletions objects/closed_captions/Step_0.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
//处理新增字幕队列
while(!ds_queue_empty(_queue_text)){
var text=ds_queue_dequeue(_queue_text);
var duration=ds_queue_dequeue(_queue_duration);

var inst=instance_create_depth(0,0,0,text_typer);
inst.text="{instant true}{alpha 1}{gui true}{scale 2}{depth "+string(DEPTH_UI.TEXT)+"}"+text+"&";
with(inst){
event_user(15);
}
inst.alpha_override=0;
Anim_Stop(inst,"alpha_override");
Anim_New(inst,"alpha_override",0,0,0,1,10,5);
ds_list_add(_list_inst,inst);
ds_list_add(_list_time,duration);
}

//处理显示时间
var proc=0;
repeat(ds_list_size(_list_inst)){
if(instance_exists(_list_inst[|proc])){
if(_list_time[|proc]>0){
_list_time[|proc]-=1;
}
}else{
_list_time[|proc]=0;
}
proc+=1;
}

//处理字幕显示完毕
var proc=0;
repeat(ds_list_size(_list_inst)){
if(_list_time[|proc]<=0){
var inst=_list_inst[|proc];
if(instance_exists(inst)){
Anim_Stop(inst,"alpha_override");
Anim_New(inst,"alpha_override",0,0,1,-1,10);
ds_list_add(_list_destroy_inst,inst);
ds_list_add(_list_destroy_time,10);
}
ds_list_delete(_list_inst,proc);
ds_list_delete(_list_time,proc);
//proc-=1;
}else{
break;
}
}

//处理字幕高度
var proc=0;
var height=0;
repeat(ds_list_size(_list_inst)){
var inst=_list_inst[|proc];
if(instance_exists(inst)){
height+=inst.height;
}
proc+=1;
}

if(_up_previous!=height){
var delay=0;
if(height<_up_previous){
delay=10;
}
Anim_Stop(self,"_up");
Anim_New(self,"_up",ANIM_TWEEN.CUBIC,ANIM_EASE.OUT,_up,height-_up,10,delay);
_up_previous=height;
}

var up_show=0;
if(height>_up){
up_show=_up;
}else{
up_show=height;
}

//处理字幕位置
var proc=0;
var yy=_y-up_show;
repeat(ds_list_size(_list_inst)){
var inst=_list_inst[|proc];
if(instance_exists(inst)){
inst.x=_x-_left;
if(proc==ds_list_size(_list_inst)-1){
inst.y=_y-inst.height;
}else{
inst.y=yy;
}
yy+=inst.height;
}
proc+=1;
}

//处理销毁实例列表
var proc=0;
repeat(ds_list_size(_list_destroy_inst)){
if(_list_destroy_time[|proc]<=0){
var inst=_list_destroy_inst[|proc];
if(instance_exists(inst)){
instance_destroy(inst);
}
}else{
_list_destroy_time[|proc]-=1;
}
if(!instance_exists(_list_destroy_inst[|proc])){
ds_list_delete(_list_destroy_inst,proc);
ds_list_delete(_list_destroy_time,proc);
proc-=1;
}
proc+=1;
}

if(!_showed&&!ds_list_empty(_list_inst)){
_showed=true;
Anim_Stop(self,"_alpha");
Anim_New(self,"_alpha",0,0,0,1,10);
}else if(_showed&&ds_list_empty(_list_inst)){
_showed=false;
Anim_Stop(self,"_alpha");
Anim_New(self,"_alpha",0,0,1,-1,10,5);
}
68 changes: 68 additions & 0 deletions objects/closed_captions/closed_captions.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion objects/menu/Other_14.gml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ switch(string_lower(_naming_name)){
break;
case "papyru":
text=Lang_GetString("menu.confirm.title.papyru");
valid=false;
break;
case "undyne":
text=Lang_GetString("menu.confirm.title.undyne");
Expand Down
4 changes: 3 additions & 1 deletion objects/text_typer/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@ _depth=0;
event_user(5);

width=0;
height=0;
height=0;
alpha_override=undefined;
_alpha_override_previous=-1;
15 changes: 15 additions & 0 deletions objects/text_typer/Step_2.gml
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,19 @@ if(_char_linked!=-1){
}
}
}
}

if(is_real(alpha_override)){
if(alpha_override!=_alpha_override_previous){
_alpha_override_previous=alpha_override;

var proc=0;
repeat(ds_list_size(_list_inst)){
var INST=ds_list_find_value(_list_inst,proc);
if(instance_exists(INST)){
INST.alpha=alpha_override;
}
proc+=1;
}
}
}
4 changes: 2 additions & 2 deletions objects/trigger/Create_0.gml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
user_char=-1;
multiple=false;
_triggered=false;
_triggered=false;
_collided_previous=false;
6 changes: 1 addition & 5 deletions objects/trigger/Other_10.gml
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
///@desc Trigger
if(_triggered){
exit;
}else{
_triggered=true;
}
_triggered=true;
1 change: 1 addition & 0 deletions objects/trigger/Other_11.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
///@desc Leave
48 changes: 15 additions & 33 deletions objects/trigger/Step_0.gml
Original file line number Diff line number Diff line change
@@ -1,37 +1,19 @@
if(!_triggered){
var user=user_char;
if(user>=-1){
var result=false;
if(instance_exists(char)){
with(char){
if(char_id==user||user==-1){
result=place_meeting(x,y,other);
if(result){
break;
}
}
var user=user_char;
var result=false;
if(instance_exists(char)){
with(char){
if(char_id==user||user==-1){
result=place_meeting(x,y,other);
if(result){
break;
}
}
if(result){
event_user(0);
}
}
}else if(multiple){
var user=user_char;
if(user>=-1){
var result=false;
if(instance_exists(char)){
with(char){
if(char_id==user||user==-1){
result=place_meeting(x,y,other);
if(result){
break;
}
}
}
}
if(!result){
_triggered=false;
}
}
}
if(!_triggered&&result){
event_user(0);
_collided_previous=true;
}else if(_triggered&&_collided_previous&&!result){
event_user(1);
_collided_previous=false;
}
Loading

0 comments on commit 6f7be68

Please sign in to comment.