this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

added workaround to use ttri() in wren

nesbox 1f28e3aa 6718e82e

+43 -35
+43 -35
src/api/wren.c
··· 77 77 foreign static ttri(x1, y1, x2, y2, x3, y3, u1, v1, u2, v2, u3, v3)\n\ 78 78 foreign static ttri(x1, y1, x2, y2, x3, y3, u1, v1, u2, v2, u3, v3, src)\n\ 79 79 foreign static ttri(x1, y1, x2, y2, x3, y3, u1, v1, u2, v2, u3, v3, src, alpha_color)\n\ 80 - foreign static ttri(x1, y1, x2, y2, x3, y3, u1, v1, u2, v2, u3, v3, src, alpha_color, z1, z2, z3)\n\ 80 + foreign static ttri_depth()\n\ 81 + foreign static ttri_depth(z1, z2, z3)\n\ 81 82 foreign static pix(x, y)\n\ 82 83 foreign static pix(x, y, color)\n\ 83 84 foreign static line(x0, y0, x1, y1, color)\n\ ··· 546 547 if(isList(vm, 4)) 547 548 { 548 549 wrenEnsureSlots(vm, top+1); 549 - int list_count = wrenGetListCount(vm, 4); 550 + s32 list_count = wrenGetListCount(vm, 4); 550 551 for(s32 i = 0; i < TIC_PALETTE_SIZE; i++) 551 552 { 552 553 wrenGetListElement(vm, 4, i, top); ··· 610 611 if(isList(vm, 4)) 611 612 { 612 613 wrenEnsureSlots(vm, top+1); 613 - int list_count = wrenGetListCount(vm, 4); 614 + s32 list_count = wrenGetListCount(vm, 4); 614 615 for(s32 i = 0; i < TIC_PALETTE_SIZE; i++) 615 616 { 616 617 wrenGetListElement(vm, 4, i, top); ··· 674 675 if(isList(vm, 7)) 675 676 { 676 677 wrenEnsureSlots(vm, top+1); 677 - int list_count = wrenGetListCount(vm, 7); 678 + s32 list_count = wrenGetListCount(vm, 7); 678 679 for(s32 i = 0; i < TIC_PALETTE_SIZE; i++) 679 680 { 680 681 wrenGetListElement(vm, 7, i, top); ··· 731 732 wrenSetSlotDouble(vm, 0, value); 732 733 } 733 734 735 + static struct 736 + { 737 + float z[3]; 738 + bool on; 739 + } depth = {0}; 740 + 741 + static void wren_ttri_depth(WrenVM* vm) 742 + { 743 + s32 top = wrenGetSlotCount(vm); 744 + 745 + depth.on = false; 746 + 747 + if (top == 4) 748 + { 749 + for (s32 i = 0; i < COUNT_OF(depth.z); i++) 750 + depth.z[i] = (float)wrenGetSlotDouble(vm, i + 1); 751 + 752 + depth.on = true; 753 + } 754 + } 755 + 734 756 static void wren_ttri(WrenVM* vm) 735 757 { 736 - int top = wrenGetSlotCount(vm); 758 + s32 top = wrenGetSlotCount(vm); 737 759 738 760 float pt[12]; 739 761 ··· 757 779 if(isList(vm, 14)) 758 780 { 759 781 wrenEnsureSlots(vm, top+1); 760 - int list_count = wrenGetListCount(vm, 14); 782 + s32 list_count = wrenGetListCount(vm, 14); 761 783 for(s32 i = 0; i < TIC_PALETTE_SIZE; i++) 762 784 { 763 785 wrenGetListElement(vm, 14, i, top); ··· 778 800 count = 1; 779 801 } 780 802 781 - float z[3]; 782 - bool depth = false; 783 - 784 - if (top > 17) 785 - { 786 - for (s32 i = 0; i < COUNT_OF(z); i++) 787 - z[i] = (float)wrenGetSlotDouble(vm, i + 15); 788 - 789 - depth = true; 790 - } 791 - 792 - tic_api_ttri(tic, pt[0], pt[1], // xy 1 793 - pt[2], pt[3], // xy 2 794 - pt[4], pt[5], // xy 3 795 - pt[6], pt[7], // uv 1 796 - pt[8], pt[9], // uv 2 797 - pt[10], pt[11], // uv 3 798 - src, // texture source 799 - colors, count, // chroma 800 - z[0], z[1], z[2], depth); // depth 803 + tic_api_ttri(tic, 804 + pt[0], pt[1], // xy 1 805 + pt[2], pt[3], // xy 2 806 + pt[4], pt[5], // xy 3 807 + pt[6], pt[7], // uv 1 808 + pt[8], pt[9], // uv 2 809 + pt[10], pt[11], // uv 3 810 + src, // texture source 811 + colors, count, // chroma 812 + depth.z[0], depth.z[1], depth.z[2], depth.on); // depth 801 813 } 802 - 803 814 static void wren_pix(WrenVM* vm) 804 815 { 805 - int top = wrenGetSlotCount(vm); 816 + s32 top = wrenGetSlotCount(vm); 806 817 807 818 s32 x = getWrenNumber(vm, 1); 808 819 s32 y = getWrenNumber(vm, 2); ··· 943 954 944 955 static void wren_cls(WrenVM* vm) 945 956 { 946 - int top = wrenGetSlotCount(vm); 957 + s32 top = wrenGetSlotCount(vm); 947 958 948 959 tic_mem* tic = (tic_mem*)getWrenCore(vm); 949 960 ··· 1392 1403 if (strcmp(signature, "static TIC.ttri(_,_,_,_,_,_,_,_,_,_,_,_)" ) == 0) return wren_ttri; 1393 1404 if (strcmp(signature, "static TIC.ttri(_,_,_,_,_,_,_,_,_,_,_,_,_)" ) == 0) return wren_ttri; 1394 1405 if (strcmp(signature, "static TIC.ttri(_,_,_,_,_,_,_,_,_,_,_,_,_,_)" ) == 0) return wren_ttri; 1395 - if (strcmp(signature, "static TIC.ttri(_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_)" ) == 0) return wren_ttri; 1406 + if (strcmp(signature, "static TIC.ttri_depth()" ) == 0) return wren_ttri_depth; 1407 + if (strcmp(signature, "static TIC.ttri_depth(_,_,_)" ) == 0) return wren_ttri_depth; 1396 1408 1397 1409 if (strcmp(signature, "static TIC.pix(_,_)" ) == 0) return wren_pix; 1398 1410 if (strcmp(signature, "static TIC.pix(_,_,_)" ) == 0) return wren_pix; ··· 1461 1473 return NULL; 1462 1474 } 1463 1475 1464 - #define API_FUNC_DEF(name, ...) wren_##name, 1465 - static const WrenForeignMethodFn ApiFuncList[] = {TIC_API_LIST(API_FUNC_DEF)}; 1466 - #undef API_FUNC_DEF 1467 - 1468 1476 static WrenForeignMethodFn bindForeignMethod( 1469 1477 WrenVM* vm, const char* module, const char* className, 1470 1478 bool isStatic, const char* signature) ··· 1496 1504 } 1497 1505 } 1498 1506 1499 - static void reportError(WrenVM* vm, WrenErrorType type, const char* module, int line, const char* message) 1507 + static void reportError(WrenVM* vm, WrenErrorType type, const char* module, s32 line, const char* message) 1500 1508 { 1501 1509 tic_core* core = getWrenCore(vm); 1502 1510