/* * cocos2d for iPhone: http://www.cocos2d-iphone.org * * Copyright (c) 2009 Jason Booth * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * */ #import #import "CCRenderTexture.h" #import "CCDirector.h" #import "ccMacros.h" #import "Support/ccUtils.h" #import "Support/CCFileUtils.h" @implementation CCRenderTexture @synthesize sprite=sprite_; // issue #994 +(id)renderTextureWithWidth:(int)w height:(int)h pixelFormat:(CCTexture2DPixelFormat) format { return [[[self alloc] initWithWidth:w height:h pixelFormat:format] autorelease]; } +(id)renderTextureWithWidth:(int)w height:(int)h { return [[[self alloc] initWithWidth:w height:h pixelFormat:kCCTexture2DPixelFormat_RGBA8888] autorelease]; } -(id)initWithWidth:(int)w height:(int)h { return [self initWithWidth:w height:h pixelFormat:kCCTexture2DPixelFormat_RGBA8888]; } -(id)initWithWidth:(int)w height:(int)h pixelFormat:(CCTexture2DPixelFormat) format { if ((self = [super init])) { NSAssert(format != kCCTexture2DPixelFormat_A8,@"only RGB and RGBA formats are valid for a render texture"); w *= CC_CONTENT_SCALE_FACTOR(); h *= CC_CONTENT_SCALE_FACTOR(); glGetIntegerv(CC_GL_FRAMEBUFFER_BINDING, &oldFBO_); // textures must be power of two NSUInteger powW = ccNextPOT(w); NSUInteger powH = ccNextPOT(h); void *data = malloc((int)(powW * powH * 4)); memset(data, 0, (int)(powW * powH * 4)); pixelFormat_=format; texture_ = [[CCTexture2D alloc] initWithData:data pixelFormat:pixelFormat_ pixelsWide:powW pixelsHigh:powH contentSize:CGSizeMake(w, h)]; free( data ); // generate FBO ccglGenFramebuffers(1, &fbo_); ccglBindFramebuffer(CC_GL_FRAMEBUFFER, fbo_); // associate texture with FBO ccglFramebufferTexture2D(CC_GL_FRAMEBUFFER, CC_GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture_.name, 0); // check if it worked (probably worth doing :) ) GLuint status = ccglCheckFramebufferStatus(CC_GL_FRAMEBUFFER); if (status != CC_GL_FRAMEBUFFER_COMPLETE) { [NSException raise:@"Render Texture" format:@"Could not attach texture to framebuffer"]; } [texture_ setAliasTexParameters]; sprite_ = [CCSprite spriteWithTexture:texture_]; [texture_ release]; [sprite_ setScaleY:-1]; [self addChild:sprite_]; // issue #937 [sprite_ setBlendFunc:(ccBlendFunc){GL_ONE, GL_ONE_MINUS_SRC_ALPHA}]; ccglBindFramebuffer(CC_GL_FRAMEBUFFER, oldFBO_); } return self; } -(void)dealloc { // [self removeAllChildrenWithCleanup:YES]; ccglDeleteFramebuffers(1, &fbo_); [super dealloc]; } -(void)begin { // Save the current matrix glPushMatrix(); CGSize texSize = [texture_ contentSizeInPixels]; // Calculate the adjustment ratios based on the old and new projections CGSize size = [[CCDirector sharedDirector] displaySizeInPixels];
extends "res://scripts/doorControl.gd"


func handle_correct():
	var apclient = global.get_node("Archipelago")
	if not apclient._door_shuffle or apclient.doorIsVanilla(self.get_parent().name + "/" + self.name):
		.handle_correct()


func openDoor():
	if !ran:
		# Basically do the same thing that the base game does.
		ran = true
		$AnimationPlayer.play("Open")