Skip to content

Commit

Permalink
Merge pull request #33 from TML233/develop
Browse files Browse the repository at this point in the history
v0.2.2
  • Loading branch information
TML233 committed Apr 20, 2019
2 parents dd6e007 + 02a34eb commit dd76c4c
Show file tree
Hide file tree
Showing 17 changed files with 129 additions and 46 deletions.
11 changes: 6 additions & 5 deletions objects/closed_captions/Step_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ while(!ds_queue_empty(_queue_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);
inst.override_alpha_enabled=true;
inst.override_alpha=0;
Anim_Stop(inst,"override_alpha");
Anim_New(inst,"override_alpha",0,0,0,1,10,5);
ds_list_add(_list_inst,inst);
ds_list_add(_list_time,duration);
}
Expand All @@ -34,8 +35,8 @@ 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);
Anim_Stop(inst,"override_alpha");
Anim_New(inst,"override_alpha",0,0,1,-1,10);
ds_list_add(_list_destroy_inst,inst);
ds_list_add(_list_destroy_time,10);
}
Expand Down
13 changes: 10 additions & 3 deletions objects/text_typer/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ _char_frame_remain=0;
_char_x=0;
_char_y=0;
_char="";
_char_sprite=-1;
_char_sprite_image=0;
_char_proc=1;
_voice_played=false;
_list_inst=ds_list_create();
Expand All @@ -23,6 +25,7 @@ _map_macro=ds_map_create();
_face=noone;
_face_linked=-1;
_char_linked=-1;
_skip_space=true;

_choice=-1;
_choice_x[0]=0;
Expand Down Expand Up @@ -58,12 +61,16 @@ _shadow_x=0.5;
_shadow_y=0.5;
_effect=-1;
_gui=false;
_depth=0;

//group init
event_user(5);

width=0;
height=0;
alpha_override=undefined;
_alpha_override_previous=-1;
override_alpha_enabled=false;
override_alpha=1;
override_color_text_enabled=false;
override_color_text[0]=c_white;
override_color_text[1]=c_white;
override_color_text[2]=c_white;
override_color_text[3]=c_white;
11 changes: 8 additions & 3 deletions objects/text_typer/Other_10.gml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if(_char!=" "&&_char!=" "){
var H2=string_height(" ");
var OFFSET=(H1-H2)/2*_scale_y;

var INST=instance_create_depth(x+_char_x,y+_char_y+OFFSET,0,text_single);
var INST=instance_create_depth(x+_char_x,y+_char_y+OFFSET,depth,text_single);
INST.text=_char;
INST.font=_group_font[_font,font];
INST.scale_x=_scale_x*_group_font_scale_x[_font,font];
Expand Down Expand Up @@ -42,7 +42,12 @@ if(_char!=" "&&_char!=" "){
INST.alpha_outline=_alpha_outline;
INST.effect=_effect;
INST.gui=_gui;
INST.depth=_depth;
if(sprite_exists(_char_sprite)){
INST.sprite=_char_sprite;
INST.sprite_image=_char_sprite_image;
INST.x+=sprite_get_xoffset(_char_sprite)*_scale_x;
INST.y+=sprite_get_yoffset(_char_sprite)*_scale_y;
}
ds_list_add(_list_inst,INST);

if(!_voice_played&&!_skipping&&!_instant&&_voice>=0){
Expand All @@ -56,7 +61,7 @@ if(_char!=" "&&_char!=" "){
}

draw_set_font(_group_font[_font,font]);
_char_x+=(string_width(_char)+_group_font_space_x[_font,font]+_space_x)*_group_font_scale_x[_font,font]*_scale_x;
_char_x+=((sprite_exists(_char_sprite) ? sprite_get_width(_char_sprite) : string_width(_char))+_group_font_space_x[_font,font]+_space_x)*_group_font_scale_x[_font,font]*_scale_x;

if(width<_char_x){
width=_char_x;
Expand Down
39 changes: 32 additions & 7 deletions objects/text_typer/Other_12.gml
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,9 @@ switch(cmd[|0]){
_choice_x[cmd[|1]]=_char_x-string_width(" ")*_group_font_scale_x[_font,0]*_scale_x;
_choice_y[cmd[|1]]=_char_y+string_height(" ")/2*_group_font_scale_y[_font,0]*_scale_y;
}
}else if(is_string(cmd[|1])){
if(cmd[|1]!=""){
_choice_macro=cmd[|1];
_choice=0;
}
}else if(is_string(cmd[|1])||is_undefined(cmd[|1])){
_choice_macro=cmd[|1];
_choice=0;
}
break;

Expand Down Expand Up @@ -349,7 +347,7 @@ switch(cmd[|0]){
x+=58*_scale_x;
event_user(4);
}
_face=instance_create_depth(x-35*_scale_x,y+25*_scale_y,_depth,_group_face[fface]);
_face=instance_create_depth(x-35*_scale_x,y+25*_scale_y,depth,_group_face[fface]);
_face.gui=_gui;
_face.image_xscale=_scale_x;
_face.image_yscale=_scale_y;
Expand Down Expand Up @@ -398,7 +396,7 @@ switch(cmd[|0]){

case "depth":
if(is_real(cmd[|1])){
_depth=cmd[|1];
depth=cmd[|1];
}
break;

Expand Down Expand Up @@ -527,4 +525,31 @@ switch(cmd[|0]){
}
}
break;

case "sprite":
var spr=cmd[|1];
if(is_string(spr)){
spr=asset_get_index(spr);
}
if(is_real(spr)){
if(sprite_exists(spr)){
var img=0;
if(is_real(cmd[|2])){
img=cmd[|2];
}
_char_sprite=spr;
_char_sprite_image=img;
_char="";
event_user(0);
_char_sprite=-1;
_char_sprite_image=0;
}
}
break;

case "skip_space":
if(is_real(cmd[|1])){
_skip_space=cmd[|1];
}
break;
}
42 changes: 25 additions & 17 deletions objects/text_typer/Step_2.gml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
_voice_played=false;
depth=_depth;

event_user(4);

Expand All @@ -17,8 +16,10 @@ if(_choice!=-1){
audio_play_sound(snd_menu_switch,0,false);
}
if(Input_CheckPressed(INPUT.CONFIRM)){
ds_map_delete(_map_macro,_choice_macro);
ds_map_add(_map_macro,_choice_macro,_choice);
if(is_string(_choice_macro)){
ds_map_delete(_map_macro,_choice_macro);
ds_map_add(_map_macro,_choice_macro,_choice);
}
Flag_Set(FLAG_TYPE.TEMP,FLAG_TEMP.TEXT_TYPER_CHOICE,_choice);
_choice=-1;
audio_play_sound(snd_menu_confirm,0,false);
Expand All @@ -35,15 +36,15 @@ if(_char_proc<string_length(text)+1){
}else{
do{
repeat(_char_per_frame){
while((string_char_at(text,_char_proc)=="{"||string_char_at(text,_char_proc)=="&"||string_char_at(text,_char_proc)==" ")&&((_sleep==0||_skipping||_instant)&&!_paused&&_char_proc<=string_length(text))){
while((string_char_at(text,_char_proc)=="{"||string_char_at(text,_char_proc)=="&"||(_skip_space&&(string_char_at(text,_char_proc)==" "||string_char_at(text,_char_proc)==" ")))&&((_sleep==0||_skipping||_instant)&&!_paused&&_char_proc<=string_length(text))){
while(string_char_at(text,_char_proc)=="{"&&((_sleep==0||_skipping||_instant)&&!_paused&&_char_proc<=string_length(text))){
_char_proc+=1;
ds_list_clear(_list_cmd);
var loop=true;
var cmd="";
var str_mode=false;
var str_input=false;
while(loop){
while(_char_proc<=string_length(text)&&loop){
var cmd_char=string_char_at(text,_char_proc);
if((cmd_char==" "||cmd_char=="}")&&!str_input){
if(!str_mode){
Expand Down Expand Up @@ -77,14 +78,17 @@ if(_char_proc<string_length(text)+1){
}
_char_proc+=1;
}
if(loop){
Console_OutputLine("WARNING! Text typer command is not valid in \""+text+"\"!");
}
}

while(string_char_at(text,_char_proc)=="&"&&((_sleep==0||_skipping||_instant)&&!_paused&&_char_proc<=string_length(text))){
event_user(1);
_char_proc+=1;
}

while(string_char_at(text,_char_proc)==" "&&((_sleep==0||_skipping||_instant)&&!_paused&&_char_proc<=string_length(text))){
while(_skip_space&&(string_char_at(text,_char_proc)==" "||string_char_at(text,_char_proc)==" ")&&((_sleep==0||_skipping||_instant)&&!_paused&&_char_proc<=string_length(text))){
_char=" ";
event_user(0);
_char_proc+=1;
Expand All @@ -110,7 +114,7 @@ if(_char_proc<string_length(text)+1){

if(instance_exists(_face)){
_face.gui=_gui;
_face.depth=_depth;
_face.depth=depth;
_face.talking=(!_sleep&&!_paused&&_char_proc<=string_length(text));
}

Expand Down Expand Up @@ -138,17 +142,21 @@ 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;
if(override_alpha_enabled||override_color_text_enabled){
var proc=0;
repeat(ds_list_size(_list_inst)){
var INST=ds_list_find_value(_list_inst,proc);
if(instance_exists(INST)){
if(override_alpha_enabled){
INST.alpha=override_alpha;
}
if(override_color_text_enabled){
INST.color_text[0]=override_color_text[0];
INST.color_text[1]=override_color_text[1];
INST.color_text[2]=override_color_text[2];
INST.color_text[3]=override_color_text[3];
}
proc+=1;
}
proc+=1;
}
}
2 changes: 1 addition & 1 deletion scripts/Battle_IsBulletValid/Battle_IsBulletValid.gml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if(!object_exists(BULLET)&&instance_exists(BULLET)){
BULLET=BULLET.object_index;
}
if(object_exists(BULLET)){
return (BULLET==battle_bullet || object_get_parent(BULLET)==battle_bullet);
return (BULLET==battle_bullet || Object_GetBaseParent(BULLET)==battle_bullet);
}else{
return false;
}
2 changes: 1 addition & 1 deletion scripts/Battle_IsEnemyValid/Battle_IsEnemyValid.gml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if(!object_exists(ENEMY) && instance_exists(ENEMY)){
}

if(object_exists(ENEMY)){
if(ENEMY==battle_enemy || object_get_parent(ENEMY)==battle_enemy){
if(ENEMY==battle_enemy || Object_GetBaseParent(ENEMY)==battle_enemy){
return true;
}else{
return false;
Expand Down
2 changes: 1 addition & 1 deletion scripts/Battle_IsSoulValid/Battle_IsSoulValid.gml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if(!object_exists(SOUL)&&instance_exists(SOUL)){
SOUL=SOUL.object_index;
}
if(object_exists(SOUL)){
return (SOUL==battle_soul || object_get_parent(SOUL)==battle_soul);
return (SOUL==battle_soul || Object_GetBaseParent(SOUL)==battle_soul);
}else{
return false;
}
2 changes: 1 addition & 1 deletion scripts/Battle_IsTurnValid/Battle_IsTurnValid.gml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if(!object_exists(TURN)&&instance_exists(TURN)){
TURN=TURN.object_index;
}
if(object_exists(TURN)){
return (TURN==battle_turn || object_get_parent(TURN)==battle_turn);
return (TURN==battle_turn || Object_GetBaseParent(TURN)==battle_turn);
}else{
return false;
}
2 changes: 1 addition & 1 deletion scripts/Battle_SetMenu/Battle_SetMenu.gml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if(MENU==BATTLE_MENU.FIGHT_AIM){

var OBJ=Flag_Get(FLAG_TYPE.STATIC,FLAG_STATIC.BATTLE_MENU_FIGHT_OBJ);
if(object_exists(OBJ)){
if(OBJ==battle_menu_fight||object_get_parent(OBJ)==battle_menu_fight){
if(OBJ==battle_menu_fight||Object_GetBaseParent(OBJ)==battle_menu_fight){
instance_create_depth(0,0,0,OBJ);
}
}
Expand Down
3 changes: 1 addition & 2 deletions scripts/Console_ParseCmd/Console_ParseCmd.gml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
if(GMU_CONSOLE_ENABLED){
var input=Console_GetInput();
var list_cmd=global._gmu_console_list_cmd;
var map_macro=global._gmu_console_map_macro;

ds_list_clear(list_cmd);

Expand All @@ -10,7 +9,7 @@ if(GMU_CONSOLE_ENABLED){
var cmd="";
var str_mode=false;
var str_input=false;
repeat(length+1){
while(proc<=length+1){
var cmd_char=string_char_at(input,proc);
if((cmd_char==" "&&!str_input)||proc>length){
if(!str_mode){
Expand Down
2 changes: 1 addition & 1 deletion scripts/Item_IsValid/Item_IsValid.gml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var ITEM=argument[0];

if(object_exists(ITEM)){
return (ITEM==item || object_get_parent(ITEM)==item);
return (ITEM==item || Object_GetBaseParent(ITEM)==item);
}else{
return false;
}
20 changes: 20 additions & 0 deletions scripts/Object_GetBaseParent/Object_GetBaseParent.gml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//@arg object
var OBJ=argument[0];

if(object_exists(OBJ)){
var parent=object_get_parent(OBJ);
if(object_exists(parent)){
var new_parent=-1;
do{
new_parent=object_get_parent(parent);
if(object_exists(new_parent)){
parent=new_parent;
}
}until(!object_exists(new_parent));
return parent;
}else{
return -1;
}
}else{
return -1;
}
8 changes: 8 additions & 0 deletions scripts/Object_GetBaseParent/Object_GetBaseParent.yy

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

2 changes: 1 addition & 1 deletion scripts/Phone_IsValid/Phone_IsValid.gml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var PHONE=argument[0];

if(object_exists(PHONE)){
return (PHONE==phone || object_get_parent(PHONE)==phone);
return (PHONE==phone || Object_GetBaseParent(PHONE)==phone);
}else{
return false;
}
Loading

0 comments on commit dd76c4c

Please sign in to comment.