diff --git a/binding-mri/bitmap-binding.cpp b/binding-mri/bitmap-binding.cpp index a49d3e5..1461e74 100644 --- a/binding-mri/bitmap-binding.cpp +++ b/binding-mri/bitmap-binding.cpp @@ -29,12 +29,6 @@ DEF_TYPE(Bitmap); -static const char *objAsStringPtr(VALUE obj) -{ - VALUE str = rb_obj_as_string(obj); - return RSTRING_PTR(str); -} - void bitmapInitProps(Bitmap *b, VALUE self) { /* Wrap properties */ @@ -264,7 +258,10 @@ RB_METHOD(bitmapDrawText) VALUE strObj; rb_get_args(argc, argv, "oo|i", &rectObj, &strObj, &align RB_ARG_END); - str = objAsStringPtr(strObj); + if (!RB_TYPE_P(strObj, RUBY_T_STRING)) + strObj = rb_funcallv(strObj, rb_intern("to_s"), 0, 0); + + str = RSTRING_PTR(strObj); } else { @@ -284,7 +281,10 @@ RB_METHOD(bitmapDrawText) VALUE strObj; rb_get_args(argc, argv, "iiiio|i", &x, &y, &width, &height, &strObj, &align RB_ARG_END); - str = objAsStringPtr(strObj); + if (!RB_TYPE_P(strObj, RUBY_T_STRING)) + strObj = rb_funcallv(strObj, rb_intern("to_s"), 0, 0); + + str = RSTRING_PTR(strObj); } else { @@ -308,7 +308,10 @@ RB_METHOD(bitmapTextSize) VALUE strObj; rb_get_args(argc, argv, "o", &strObj RB_ARG_END); - str = objAsStringPtr(strObj); + if (!RB_TYPE_P(strObj, RUBY_T_STRING)) + strObj = rb_funcallv(strObj, rb_intern("to_s"), 0, 0); + + str = RSTRING_PTR(strObj); } else { diff --git a/src/input.cpp b/src/input.cpp index 5e1085b..9e38436 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -599,8 +599,13 @@ void Input::update() { p->repeatCount++; - /* Repeatsequence is [r...............(r...)+] */ - if (p->repeatCount > 15 && ((p->repeatCount % 4) == 0)) + bool repeated; + if (rgssVer >= 2) + repeated = p->repeatCount >= 24 && (p->repeatCount % 6) == 0; + else + repeated = p->repeatCount >= 16 && (p->repeatCount % 4) == 0; + + if (repeated) p->getState(p->repeating).repeated = true; return;