すくすくゴートうちゃん Android 版(黒歴史)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

char.mod.hsp 1.5 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #ifndef __CHAR__
  2. #define __CHAR__
  3. #module \
  4. Char
  5. #const CHAR_WIDTH 32
  6. #const UNKNOWN 52
  7. #defcfunc local \
  8. New \
  9. int p_posX,\
  10. int p_posY,\
  11. str p_text
  12. If insNum <= 0 {
  13. SDim charDict, 384
  14. SDim text, 1024
  15. BLoad "dict.dat", charDict
  16. }
  17. text.insNum = p_text
  18. posX.insNum = p_posX
  19. posY.insNum = p_posY
  20. size.insNum = CHAR_WIDTH
  21. exists.insNum = True
  22. insNum++
  23. Return insNum - 1
  24. #deffunc local \
  25. Destroy \
  26. int p_insId
  27. exists.p_insId = False
  28. Return
  29. #deffunc local \
  30. Draw \
  31. local l_cnt,\
  32. local l_found
  33. Repeat insNum
  34. If exists.cnt {
  35. l_cnt = cnt
  36. Repeat StrLen (text.l_cnt) / 3
  37. l_found = MyInStr (charDict, 0, StrMid (text.l_cnt, cnt * 3, 3)) / 3
  38. If darw_found < 0 {
  39. l_found = UNKNOWN
  40. }
  41. Pos posX.l_cnt + cnt * size.l_cnt, posY.l_cnt
  42. l_zoom = Double (size.l_cnt) / CHAR_WIDTH
  43. CelPut BUFFER_CHAR, l_found, l_zoom, l_zoom
  44. Loop
  45. }
  46. Loop
  47. Return
  48. #defcfunc local \
  49. MyInStr \
  50. str p_haystack,\
  51. int p_offset,\
  52. str p_needle
  53. myInStr_haystack = p_haystack
  54. myInStr_flag = True
  55. Repeat StrLen (myInStr_haystack) / 3
  56. SDim myInStr_work, 3
  57. myInStr_cnt = cnt
  58. Repeat 3
  59. Poke myInStr_work, cnt, Peek (myInStr_haystack, myInStr_cnt * 3 + cnt)
  60. Loop
  61. If myInStr_work = p_needle {
  62. myInStr_flag = False
  63. Break
  64. }
  65. Loop
  66. If myInStr_flag {
  67. Return -1
  68. }
  69. Return myInStr_cnt * 3
  70. #defcfunc local \
  71. MyStrMid \
  72. str p_string,\
  73. int p_offset,\
  74. int p_length,\
  75. int p_test
  76. myStrMid_string = p_string
  77. SDim myStrMid_return, p_length
  78. Return myStrMid_return
  79. #global
  80. #endif ; not __CHAR__